Commit c2160b7
Fix focus navigation loop for internal popover invokers
When a popover is opened with an invoker that is inside the popover
itself (e.g. via `showPopover({source: btn})`), the focus navigation
logic in FocusController previously treated that internal element as
the scope owner for the popover.
Because the scope owner was a descendant of the popover itself,
traversing out of the popover focus scope (e.g. upon reaching the end
of the popover or tabbing away) would re-resolve the popover scope from
the internal owner, creating a cyclic ownership chain and causing an
infinite loop or stack overflow crash.
This patch updates `InvokerForOpenPopover()` and
`GetOpenPopoverTarget()` to return nullptr when
`FlatTreeTraversal::Contains()` finds the invoker inside the popover,
preventing internal invokers from acting as scope owners.
Fixed: 542274292
Change-Id: I6ff5fed25db2b4d255cb36873d5fbc480ae620da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8265901
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1683577}1 parent fbb56f5 commit c2160b7
1 file changed
Lines changed: 39 additions & 0 deletions
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments