Skip to content

Commit 7d958d0

Browse files
committed
fix(ui5-li): only handle F7/F2 when tabbable elements exist
F7 and F2 navigation now checks if there are tabbable elements inside the list item before handling the event. If no tabbable elements exist (e.g., delete button with tabindex="-1"), the event propagates to allow parent components like Tokenizer to handle it with their custom logic. This fixes interference with Tokenizer's F7 behavior while maintaining correct navigation for custom list items.
1 parent 363e871 commit 7d958d0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/main/src/ListItem.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,17 @@ abstract class ListItem extends ListItemBase {
535535
}
536536

537537
_handleF7(e: KeyboardEvent) {
538-
e.preventDefault();
539-
540538
const focusDomRef = this.getFocusDomRef()!;
541539
const activeElement = getActiveElement();
542540
const list = this._getList();
543541

542+
const focusables = this._getFocusableElements().length > 0;
543+
if (!focusables) {
544+
return;
545+
}
546+
547+
e.preventDefault();
548+
544549
if (activeElement === focusDomRef) {
545550
this._focusInternalElement(list);
546551
} else {
@@ -555,6 +560,11 @@ abstract class ListItem extends ListItemBase {
555560
const focusDomRef = this.getFocusDomRef()!;
556561
const activeElement = getActiveElement();
557562

563+
const focusables = this._getFocusableElements().length > 0;
564+
if (!focusables) {
565+
return;
566+
}
567+
558568
if (activeElement === focusDomRef) {
559569
const firstFocusable = await getFirstFocusableElement(focusDomRef);
560570
firstFocusable?.focus();

0 commit comments

Comments
 (0)