Files
headlessui/packages/@headlessui-react/pages
Robin Malfait 958e3ea8c6 bug fixes (#261)
* apply re-focus bug fix to Popover

* force focus in Menu.Items from within Menu.Items component itself

* force focus in Listbox.Options from within Listbox.Options component itself

* fix undefined values in id's

We were setting the element in state, but updates to the id were not taken into account

* update the caniuse db

* ensure useInertOthers works in multiple places

Previously each hook call would take care of the whole tree. However
when multiple calls to this hook are happening we need to make sure that
you are not removing the aria-hidden when another hook is still used.

This will fix that by keeping track of a list of "interactable" items,
and updating the parents (root of the body) accordingly.

* add the concept of a Stack

When you are rendering a Dialog, we will make sure that this Dialog is
rendered inside a Portal. However, when you are also rendering a Menu,
there is a chance that your Menu doesn't fit within the Dialog,
therefore you will likely render the Menu.Items inside a Portal so that
you can style it as if it is rendered inside but overflows the Dialog
correctly.

This introduces an interesting/annoying problem. Your Menu.Items are now
rendered in a Portal, as a *sibling* to the Dialog. This means that
autoFocus, focusTrap, ... all these features don't work as expected.

Introducing this Stack will allow us to register DOM nodes into a list
of contains that we consider being part of the main container. In other
words, the sibling Menu.Items will now be considered part of the Dialog.
Even though it is rendered *outside* of the Dialog.

This concept also allows for some fun stuff, for example, nesting
Dialog's is no problem with this approach. Dialogs are technically
rendered as siblings in the Portal, but the FocusTrap, and all that just
works as expected.

* capture keyboard events in the capturing phase

This will allow us to use event.stopPropagation() in the code (which
will be required, probably) but still see the keystrokes in the
playground.

* stop propagating keyboard events

This looks a bit silly, and ideally we can solve this in a more elegant
way. However when you nest a Menu inside a Dialog, both of those
components have a `close on escape` functionality built in. However when
your Menu is open, and you press escape, you only want to close the
Menu, not the Dialog. Therefore if we `event.stopPropagation()` it
allows us to stop the `escape` keystroke in the Menu from reaching all
the way to the Dialog itself.

* update Dialog example that showcases nested Dialogs, and nested Menu

* update changelog
2021-04-02 15:55:15 +02:00
..
2021-04-02 15:55:15 +02:00
2021-04-02 15:55:14 +02:00
2021-01-30 14:46:54 +01:00
2021-01-30 14:46:54 +01:00
2021-04-02 15:55:14 +02:00
2021-01-30 14:46:54 +01:00
2021-04-02 15:55:15 +02:00
2021-01-30 14:46:54 +01:00