Commit d219d64
committed
fix(ui5-li): prevent item-click when interactive content is clicked
Previously, `_onclick` in `ListItemBase` suppressed the `_press` event
by checking `:has(:focus-within)` on the focus DOM ref. This approach
is fragile: if a nested interactive element (e.g. a button) disables
itself synchronously during its own `click` handler, focus is lost
before the event bubbles up to the list item. As a result, the
`:focus-within` check fails and `ui5-item-click` fires unexpectedly ?
a regression observed in Chrome since v2.4.0.
Replace the focus-based guard with an event-path inspection:
`_isInteractiveContentClicked` walks `e.composedPath()` from the
clicked target up to (but not including) the list item boundary and
returns `true` if any element matches a native or UI5 interactive
control. This correctly suppresses `item-click` regardless of whether
the inner element changes its disabled/focused state during the click.
Add a regression test: nested `ui5-button` that disables itself on
click must not trigger `ui5-item-click` on the parent list item.
Fixes: #109761 parent fb3a1ca commit d219d64
2 files changed
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
701 | 732 | | |
702 | 733 | | |
703 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
174 | 197 | | |
175 | 198 | | |
176 | 199 | | |
| |||
0 commit comments