Skip to content

Commit

Permalink
Only check for elements in useInertOthers (#3154)
Browse files Browse the repository at this point in the history
* Only check for elements in useInertOthers

* Update changelog

* Update packages/@headlessui-react/CHANGELOG.md

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
  • Loading branch information
thecrypticace and reinink committed Apr 30, 2024
1 parent 4acf9e2 commit 319bcba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `overflow: auto` when using the `anchor` prop ([#3138](https://github.com/tailwindlabs/headlessui/pull/3138))
- Ensure `TransitionRoot` component without props transitions correctly ([#3147](https://github.com/tailwindlabs/headlessui/pull/3147))
- Ensure the `static` and `portal` props work nicely together ([#3152](https://github.com/tailwindlabs/headlessui/pull/3152))
- Only check for elements in `useInertOthers` ([#3154](https://github.com/tailwindlabs/headlessui/pull/3154))

### Changed

Expand Down
2 changes: 1 addition & 1 deletion packages/@headlessui-react/src/hooks/use-inert-others.tsx
Expand Up @@ -103,7 +103,7 @@ export function useInertOthers(
let parent = element.parentElement
while (parent && parent !== ownerDocument.body) {
// Mark all siblings as inert
for (let node of parent.childNodes) {
for (let node of parent.children) {
// If the node contains any of the elements we should not mark it as inert
// because it would make the elements unreachable.
if (allowedElements.some((el) => node.contains(el))) continue
Expand Down

0 comments on commit 319bcba

Please sign in to comment.