9ecd8dd926
* use the Dialog's parent as the root for the Intersection observer We have some code that allows us to auto-close the dialog the moment it gets hidden. This is useful if you use a dialog for a mobile menu and you resizet he browser. If you wrap the dialog in a `md:hidden` then it auto closes. If we don't do this, then the dialog is still locking the scrolling, keeping the focus in the dialog, ... but it is not visible. To solve this we use an `IntersectionObserver` to verify that the `boundingClientRect` is "gone" (x = 0, y = 0, width = 0 and height = 0). However, the intersection observer is not always triggered. This happens if the main content is scrollable. Setting the `root` of the `IntersectionObserver` to the parent of the `Dialog` does seem to solve it. Not 100% sure what causes this behaviour exactly. * use a `ResizeObserver` instead of `IntersectionObserver` * implement a `ResizeObserver` for the tests * update changelog
@headlessui/react
A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.
Installation
npm install @headlessui/react
Documentation
For full documentation, visit headlessui.dev.
Community
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using the library: