Only check for elements in useInertOthers (#3154)

* Only check for elements in useInertOthers

* Update changelog

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

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
This commit is contained in:
Jordan Pittman
2024-04-30 10:40:58 -04:00
committed by GitHub
parent 4acf9e27f1
commit 319bcbad3b
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -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
@@ -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