Commit Graph

153 Commits

Author SHA1 Message Date
Elliott Marquez
4f7ff4f63a fix(menu): resolve aborted animations as false rather than reject
fixes #5638

PiperOrigin-RevId: 642044142
2024-06-10 15:35:32 -07:00
Material Web Team
e1f9cbc59e fix(menu): getBoundingClientRect() and getClientRects() not working
PiperOrigin-RevId: 634601756
2024-05-16 19:12:29 -07:00
Elizabeth Mitchell
1bf8b5fbf9 feat(menu): allow customizing scrollbar-width
PiperOrigin-RevId: 629196509
2024-04-29 15:01:44 -07:00
Elizabeth Mitchell
c35bad0c64 fix: rename internal <styles>.css.js to <styles>.css
We are changing the names of these files to reduce similarity with CSS modules and avoid clashing with tooling built around that. If you're importing `*/internal/styles.css.js`, swap to `*/internal/styles.js`.

PiperOrigin-RevId: 611265000
2024-02-28 16:20:22 -08:00
Elizabeth Mitchell
c6ffd70fc8 feat(menu): add no-navigation-wrap to fix select accessibility
PiperOrigin-RevId: 610514684
2024-02-26 13:46:47 -08:00
Elizabeth Mitchell
ec0a8ebf6e chore: use CSSResultOrNative instead of CSSResult for static styles
PiperOrigin-RevId: 609760445
2024-02-23 10:01:56 -08:00
Elizabeth Mitchell
ce41b7bfb3 fix: use explicit CSSResult[] types for static styles
PiperOrigin-RevId: 609494809
2024-02-22 14:15:11 -08:00
Material Web Team
2049323dde fix(menu): left arrow in submenu closes submenu in closure
PiperOrigin-RevId: 608184142
2024-02-18 17:28:53 -08:00
Kaspar Papli
f0e78db6d2
docs: fix wording issue in submenu docs 2024-02-12 20:53:55 +01:00
Kaspar Papli
b1efe3222c
docs: fix typos and wording issues in menu docs 2024-02-12 20:51:37 +01:00
Elizabeth Mitchell
84536d7416 chore: update components to use custom properties from tokens
PiperOrigin-RevId: 601597083
2024-01-25 16:13:41 -08:00
Elizabeth Mitchell
86bd6f8309 fix(menu): --md-menu-item-container-color not working
This change removes the leftover md-comp-menu-list-item token set, which doesn't have a corresponding component. If you're using it, the correct token set to use is md-comp-menu-item.

As a side effect of the merge, it also added the missing menu item container-color token.

PiperOrigin-RevId: 601168134
2024-01-24 10:44:44 -08:00
Jan Kuehle
4b4c373a6b chore: use import and export types
PiperOrigin-RevId: 599338980
2024-01-17 17:39:46 -08:00
Copybara-Service
80edf15920 Merge pull request #5229 from aarondrabeck:md-menu-color-fix
PiperOrigin-RevId: 591297433
2023-12-15 10:37:44 -08:00
Elliott Marquez
c4cbd3612c fix(menu): shift tab into anchor closes menu
PiperOrigin-RevId: 589173373
2023-12-08 10:25:43 -08:00
Material Web Team
bd88880f78 fix(menu): escape not closing menus with submenus
Ensure pressing escape while on a closed submenu anchor, closes the parent menu

Previously we were not letting a user close a menu when they were focused on any item with keepOpen = true. This included submenu anchors.

This change adds an escape (hehe) hatch to ensure that even on items with keepOpen = true, escape closes the menu. This is what most users expect and is what is the standard on menus around the web.

PiperOrigin-RevId: 587874713
2023-12-04 16:22:47 -08:00
Elliott Marquez
aafea84115 docs(menu): set target to _blank in demos
PiperOrigin-RevId: 587866823
2023-12-04 15:52:45 -08:00
Elliott Marquez
af49b64ab4 feat(menu,select): allow menu and select typeahead to read default slot text content
PiperOrigin-RevId: 587864760
2023-12-04 15:45:18 -08:00
Elizabeth Mitchell
c319236cd1 refactor: remove Firefox ARIAMixin polyfills (v119+)
This is now fixed in the latest two versions of Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1785412

PiperOrigin-RevId: 586442947
2023-11-29 13:48:38 -08:00
Aaron Drabeck
063ac88a07 fix(menu): prevent default popover color from overriding menu surface 2023-11-29 10:47:07 -07:00
Material Web Team
3d8c7ac7f3 fix(menu): declare popover property type on HTMLElement
Without it the popover property got renamed by closure.

PiperOrigin-RevId: 584184281
2023-11-20 18:53:26 -08:00
Material Web Team
bf8d3f6289 fix(menu): declare popover API types
Without it show/hide popover get renamed by closure.

PiperOrigin-RevId: 582471354
2023-11-14 16:12:59 -08:00
Elliott Marquez
2adcb1479a docs: document events in jsdoc
PiperOrigin-RevId: 581041601
2023-11-09 15:25:21 -08:00
Elliott Marquez
7859b39afe 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
2023-11-08 13:14:25 -08:00
Elliott Marquez
2b591ca759 feat(menu): add document-level positioning
related #5120

PiperOrigin-RevId: 580293404
2023-11-07 14:04:00 -08:00
Elizabeth Mitchell
f5daadc307 chore: update components to use mixinFocusable
PiperOrigin-RevId: 576982507
2023-10-26 14:09:08 -07:00
Elizabeth Mitchell
c390291687 chore: format files with prettier
PiperOrigin-RevId: 576601342
2023-10-25 11:59:00 -07:00
Elliott Marquez
863109e204 fix(menu): fix menu OOB from resizing window
fixes #5063

PiperOrigin-RevId: 574286021
2023-10-17 15:42:11 -07:00
Material Web Team
4b00a9561c fix(list): list items will not escape their parent when parent width is restricted
PiperOrigin-RevId: 572988261
2023-10-12 12:59:19 -07:00
Elliott Marquez
8bbb4b4fff fix(menu): fix menu tapping behaviors on iOS and do not close on anchor click
fixes #5036
fixes #5015

iOS has some really bad behaviors when it comes to clicking and focus. clicking on the body on a non-clickable item (like anything outside a menu) does not tirgger a click event that bubbles to menu. Also, clicking on a button does not cause it to be focused, thus depriving us of information on focusout's related target. Therefore we have to assume the anchor is the trigger.

PiperOrigin-RevId: 572137765
2023-10-09 22:35:02 -07:00
Elizabeth Mitchell
c9aadeb585 chore(menu): merge HCM styles
PiperOrigin-RevId: 571239710
2023-10-05 23:28:28 -07:00
Elliott Marquez
8ae8c02866 fix(menu,select): enter clicks href items
PiperOrigin-RevId: 571104363
2023-10-05 12:55:39 -07:00
Elliott Marquez
d6f7220f0b fix(menu): fix submenu SSR left keyboard close navigation
PiperOrigin-RevId: 569664658
2023-09-29 21:44:51 -07:00
Elliott Marquez
c346f5b977 build: visibility changes
PiperOrigin-RevId: 569032710
2023-09-27 19:46:00 -07:00
Elliott Marquez
73eb15ebee fix(menu): fix menu item fade in order animation
fixes #5014

PiperOrigin-RevId: 568949388
2023-09-27 13:47:41 -07:00
Elliott Marquez
d27ef2e059 fix(menu): expose item custom properties and fix selected color
PiperOrigin-RevId: 568344744
2023-09-25 15:47:19 -07:00
Elizabeth Mitchell
682a39c480 chore(menu): update demo a11y
PiperOrigin-RevId: 568337321
2023-09-25 15:16:42 -07:00
Elliott Marquez
aeb5103e1c fix(menu,select): fix final aria issues
PiperOrigin-RevId: 568326002
2023-09-25 14:31:52 -07:00
Elliott Marquez
6d0c7e8538 refactor(list)!: refactor list to reuse ListController
fixes #4967

also fixes list-root focus ring and focusout

BREAKING CHANGE: the new ListController behavior no longer waits for event.preventDefault asynchronously because it was causing keyboard navigations to scroll the page.

PiperOrigin-RevId: 568300155
2023-09-25 12:54:12 -07:00
Elliott Marquez
5e4434bfed fix(select): update select docs and fix initial selection
PiperOrigin-RevId: 567884899
2023-09-23 11:14:56 -07:00
Elliott Marquez
f81ce1131b refactor(select): refactor select so that it doesn't rely on menuitem & use logic controller
PiperOrigin-RevId: 567735675
2023-09-22 15:45:50 -07:00
Elizabeth Mitchell
b35212a9ac feat(items): add <md-item> to @material/web/labs
PiperOrigin-RevId: 567734991
2023-09-22 15:42:42 -07:00
Elliott Marquez
5fad4f088f feat(menu): create a Menu interface for easier md-menu wrapping
PiperOrigin-RevId: 567728911
2023-09-22 15:15:41 -07:00
Elliott Marquez
1217b62ef2 refactor(menu)!: pull logic out of menuitem into a controller & change enum vals
BREAKING CHANGE: Several enums in menu had their values changed from SCREAM_CASE to kebab-case to follow style guide. They are NAVIGABLE_KEYS -> NavigableKey, SELECTION_KEY -> SelectionKey, CLOSE_REASON -> CloseReason, KEYDOWN_CLOSE_KEY -> KeydownCloseKey

PiperOrigin-RevId: 567727434
2023-09-22 15:09:41 -07:00
Elliott Marquez
63b01425e7 refactor(menu,select)!: rename fixed to positioning
This will enable forwards compatibility for `positioning="top-layer"` with popover.

BREAKING CHANGE: refactor `fixed` property to `positioning="fixed"` in Menu and `menuFixed` to `menuPositioning="fixed"`

PiperOrigin-RevId: 567723646
2023-09-22 14:54:57 -07:00
Elliott Marquez
2a1d8776a7 refactor(menu)!: refactor menu-item to use md-item and not rely on md-list-item
BREAKING CHANGE: This change refactors menu-item to no longer subclass or import from list-item. It also refactors it to use md-item directly which means that the API of menu item has moved from properties to slots. `start-*` and `end-*` slots are now just `start` and `end`, many tokens are now gone in favor of slotting. `headline` property is now a `slot="headline"` slot. Typeahead search text can now be set via `typeaheadText` which defaults to the slotted headline `textContent`. `select-option` now has the `displayText` which is used to display text in the `md-select` when the option is selected; defaults to the slotted headline `textContent`.

PiperOrigin-RevId: 567719483
2023-09-22 14:35:46 -07:00
Elliott Marquez
d6cbf74137 refactor(menu)!: remove sub-menu-item in favor of sub-menu
BREAKING CHANGE: We have deleted `md-sub-menu-item`. Instead it is recommended to use `md-sub-menu` which can have `md-menu-item[slot=item]` and `md-menu[slot=menu]` slotted into it. This makes `sub-menu-item` accessible for screen readers using linear navigation

PiperOrigin-RevId: 567706398
2023-09-22 13:41:43 -07:00
Elliott Marquez
0384507447 refactor(menu)!: update menu to use host-aria
BREAKING CHANGE: Menu no longer uses md-list internally which means the list-related properties such as `list-tabindex` and `type` should now be on the host of md-menu. The new attributes should be `tabindex` and `role` respectively.

PiperOrigin-RevId: 567702229
2023-09-22 13:24:21 -07:00
Elliott Marquez
c7c276fdfa feat(menu): do not close menu if anchor is clicked
PiperOrigin-RevId: 567096832
2023-09-20 15:25:03 -07:00
Elliott Marquez
54fbb2ed5e feat(menu): implement md-sub-menu
md-sub-menu will succeed md-sub-menu-item. It allows for screen reader linear navigation

PiperOrigin-RevId: 567057310
2023-09-20 13:09:44 -07:00