Ensure PopoverPanel
can be used inside <transition>
#1653
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a bit sad, but it is how Vue works
We used to render just a simple PopoverPanel that resolved to let's say a
<div>
, that's all good. Because the native<transition>
component requires that there is only 1 DOM child (regardless of the Vue "tree"). This is the sad part, because we simplified focus trapping for the Popover by introducing sibling hidden buttons to capture focus instead of managing this ourselves.Since we can't just return multiple items we wrap them in a
Fragment
component.If you wrap items in a Fragment, then a lot of Vue's magic goes away (automatically adding
class
to the root node). Luckily, Vue has a solution for that, which isinheritAttrs: false
and then manually spreading theattrs
onto the correct element.This all works beautiful, but not for the
<transition>
component... so... let's move the focus trappable elements inside the actual Panel and update the logic slightly to go to the Next/Previous item instead of the First/Last because the First/Last will now be the actual focus guards.Fixes: #1483
Fixes: #1629