Skip to content

Commit

Permalink
WIP(ui-dom-utils): update findFocusable logic
Browse files Browse the repository at this point in the history
  • Loading branch information
instructure-ui-ci authored and matyasf committed Jul 21, 2023
1 parent 1732297 commit 01e4ef8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
3 changes: 0 additions & 3 deletions packages/ui-dom-utils/src/__tests__/findTabbable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ describe('findTabbable', async () => {
<button>Yep</button>
<button style={{ display: 'none' }}>Nope</button>
</div>
<div style={{ width: 0, height: 0 }}>
<button>Nope</button>
</div>
</div>
)
/* eslint-enable jsx-a11y/no-noninteractive-tabindex */
Expand Down
7 changes: 1 addition & 6 deletions packages/ui-dom-utils/src/findFocusable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,7 @@ function findFocusable(

function hidden(element: Element | Node) {
const cs = getComputedStyle(element)
return (
(cs.display !== 'inline' &&
(element as HTMLElement).offsetWidth <= 0 &&
(element as HTMLElement).offsetHeight <= 0) ||
cs.display === 'none'
)
return cs.display === 'none'
}

function positioned(element: Element | Node) {
Expand Down

0 comments on commit 01e4ef8

Please sign in to comment.