-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(menu): add popover functionality
Uses popover API for browsers that support it. Falls back to fixed positioning on browsers that do not. fixes #2023 fixes #5120 PiperOrigin-RevId: 580633646
- Loading branch information
1 parent
5bb4a42
commit 7859b39
Showing
8 changed files
with
166 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="figure-wrapper"> | ||
<figure | ||
style="justify-content: center" | ||
aria-label="A filled button that says open popover menu. Interact with the button to open a popover menu." | ||
> | ||
<div> | ||
<div style="margin: 16px"> | ||
<md-filled-button id="usage-popover-anchor">Open popover menu</md-filled-button> | ||
</div> | ||
<md-menu positioning="popover" id="usage-popover" anchor="usage-popover-anchor"> | ||
<md-menu-item> | ||
<div slot="headline">Apple</div> | ||
</md-menu-item> | ||
<md-menu-item> | ||
<div slot="headline">Banana</div> | ||
</md-menu-item> | ||
<md-menu-item> | ||
<div slot="headline">Cucumber</div> | ||
</md-menu-item> | ||
</md-menu> | ||
</div> | ||
<script type="module"> | ||
const anchorEl = document.body.querySelector("#usage-popover-anchor"); | ||
const menuEl = document.body.querySelector("#usage-popover"); | ||
anchorEl.addEventListener("click", () => { | ||
menuEl.open = !menuEl.open; | ||
}); | ||
</script> | ||
</figure> | ||
</div> |
Binary file not shown.
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
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