-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change brings the Ember implementation closer inline with the React/Vue implementations, which do not create a DOM node for this component automatically. This makes working with the component easier, as it no longer introduces un-necessary DOM nodes. Note: the React and Vue implementations allow for optionally creating a DOM node for the `Menu` component. This is possible in Ember, technically, but probably more trouble than it's worth, since the user of `Menu` can just wrap the component in an additional DOM node themselves if that's what they want. I believe the React and Vue implementations include this functionality for consistency, so that _all_ Headless UI components can optionally render an alternate DOM node, but those frameworks have an easier ability to pull this off than Ember does. A focus trap has been introduced to power the click-outside-to-dismiss functionality, which also resolves the issue of focus needing to be locked in the `Menu::Items` component when rendered, which was previously not the case. BREAKING CHANGE: If you were previously depending on `Menu` rendering a DOM node, you'll want to wrap your usage of `Menu` with a `div` and move any attributes or modifiers to that element instead.
- Loading branch information
1 parent
fa2ca27
commit e46741d
Showing
5 changed files
with
66 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,34 @@ | ||
<div | ||
id={{this.guid}} | ||
...attributes | ||
{{on 'pointerdown' this.onPointerDown}} | ||
{{click-outside this.close event='mouseup'}} | ||
> | ||
{{yield | ||
(hash | ||
{{yield | ||
(hash | ||
isOpen=this.isOpen | ||
Button=(component | ||
'menu/button' | ||
buttonGuid=this.buttonGuid | ||
itemsGuid=this.itemsGuid | ||
isOpen=this.isOpen | ||
Button=(component | ||
'menu/button' | ||
guid=this.buttonGuid | ||
menuGuid=this.guid | ||
itemsGuid=this.itemsGuid | ||
isOpen=this.isOpen | ||
onClick=this.toggle | ||
openMenu=this.open | ||
closeMenu=this.close | ||
goToFirstItem=this.goToFirstItem | ||
goToLastItem=this.goToLastItem | ||
goToNextItem=this.goToNextItem | ||
goToPreviousItem=this.goToPreviousItem | ||
) | ||
Items=(component | ||
'menu/items' | ||
guid=this.itemsGuid | ||
buttonGuid=this.buttonGuid | ||
isOpen=this.isOpen | ||
closeMenu=this.close | ||
activeItem=this.activeItem | ||
registerItem=this.registerItem | ||
unregisterItem=this.unregisterItem | ||
goToFirstItem=this.goToFirstItem | ||
goToLastItem=this.goToLastItem | ||
goToNextItem=this.goToNextItem | ||
goToPreviousItem=this.goToPreviousItem | ||
goToItem=this.goToItem | ||
search=(perform this.searchTask) | ||
) | ||
openMenu=this.open | ||
closeMenu=this.close | ||
toggleMenu=this.toggle | ||
goToFirstItem=this.goToFirstItem | ||
goToLastItem=this.goToLastItem | ||
goToNextItem=this.goToNextItem | ||
goToPreviousItem=this.goToPreviousItem | ||
) | ||
}} | ||
</div> | ||
Items=(component | ||
'menu/items' | ||
buttonGuid=this.buttonGuid | ||
itemsGuid=this.itemsGuid | ||
isOpen=this.isOpen | ||
closeMenu=this.close | ||
activeItem=this.activeItem | ||
registerItem=this.registerItem | ||
unregisterItem=this.unregisterItem | ||
goToFirstItem=this.goToFirstItem | ||
goToLastItem=this.goToLastItem | ||
goToNextItem=this.goToNextItem | ||
goToPreviousItem=this.goToPreviousItem | ||
goToItem=this.goToItem | ||
search=(perform this.searchTask) | ||
) | ||
) | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters