Skip to content

Commit

Permalink
fix(@clayui/shared): fixes error when identifying non-visible element…
Browse files Browse the repository at this point in the history
… as focusable
  • Loading branch information
matuzalemsteles committed Oct 18, 2022
1 parent 1c2236e commit 82cc0f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/clay-shared/src/useFocusManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ export const FOCUSABLE_ELEMENTS = [
function collectDocumentFocusableElements() {
return Array.from<HTMLElement>(
document.querySelectorAll(FOCUSABLE_ELEMENTS.join(','))
).filter((element) => isFocusable(element));
).filter((element) => {
if (isFocusable(element)) {
return window.getComputedStyle(element).visibility !== 'hidden';
}

return false;
});
}

// https://github.com/facebook/react/pull/15849#diff-39a673d38713257d5fe7d90aac2acb5aR107
Expand Down

0 comments on commit 82cc0f8

Please sign in to comment.