Skip to content

Commit

Permalink
Fix isFocusable for FocusList component (#10378)
Browse files Browse the repository at this point in the history
* Fix isFocusable for FocusList component

* Use explicit check for null
  • Loading branch information
microbit-robert authored Feb 12, 2025
1 parent 8074d0b commit d43f4c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion react-common/components/controls/FocusList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const FocusList = (props: FocusListProps) => {

const isFocusable = (e: HTMLElement) => {
return e.getAttribute("data-isfocusable") === "true"
&& getComputedStyle(e).display !== "none";
&& e.offsetParent !== null;
}

const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion react-common/components/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function findNextFocusableElement(elements: HTMLElement[], focusedIndex:
index += increment;
}
}
return findNextFocusableElement(elements, focusedIndex, index, forward);
return findNextFocusableElement(elements, focusedIndex, index, forward, isFocusable);
}

export function isFocusable(e: HTMLElement) {
Expand Down

0 comments on commit d43f4c8

Please sign in to comment.