Commit Graph

94 Commits

Author SHA1 Message Date
Elliott Marquez
2927245114 fix(menu): menu's default focus behavior follows google accessibility practices
default focus is now FIRST_ITEM and instead of LIST_ROOT and the menu / list itself has tabindex -1 by default as our a11y model recommends

PiperOrigin-RevId: 565244488
2023-09-13 21:02:33 -07:00
Elizabeth Mitchell
573caaee1b fix(select)!: don't reflect selected attribute
Why? This is needed for selects in forms, which uses the `selected` attribute to indicate default selected values when resetting.

BREAKING CHANGE: `option.selected` no longer reflects. Set the attribute instead if relying on the attribute for styles/queries.

PiperOrigin-RevId: 565212026
2023-09-13 17:51:17 -07:00
Material Web Team
556e6f95e4 chore: fix closure compiler issues
PiperOrigin-RevId: 564867173
2023-09-12 16:30:19 -07:00
Elliott Marquez
8e79da6f41 docs(menu): lessen indirection code reuse in stories
PiperOrigin-RevId: 563544292
2023-09-07 14:21:40 -07:00
Elliott Marquez
368991ce30 fix(menu): fix submenus on mobile
PiperOrigin-RevId: 563531654
2023-09-07 13:39:19 -07:00
Elliott Marquez
235a2033d7 feat(menu): menus will resize and flip corners to stay in viewport
This is a change to the repositioning algorithm that attempts to keep the surface in the screen. This largely follows the behavior of Wiz's implementation.

Instead of just repositioning the surface in the window, it will also attempt to flip the anchor and surface anchors and compares whether that will cause less repositioning of the menu. It also adds the option for it to resize the surface rather than just move it so that it doesn't overlap other components like md-select.

PiperOrigin-RevId: 563475751
2023-09-07 10:36:11 -07:00
Elliott Marquez
2e25bf8ce2 fix(menu): update default min width to spec and allow max-width to inherit
PiperOrigin-RevId: 563224653
2023-09-06 14:57:50 -07:00
Elliott Marquez
7a19c7e97a fix(menu): allow submenus to close when focus is lost
PiperOrigin-RevId: 563207098
2023-09-06 13:55:21 -07:00
Elliott Marquez
b85b57fa79 fix(menu,list,select): do not stopPropagation on native events when handled only prevent default
Fixes #4817

We need to communicate between components when an event has been handled (e.g. keyboard navigation or clicking). This CL focuses on listening to `defaultPrevented` in order to communicate that something was handled. We also have to patch ripple on submenu to make sure that the ripple isn't triggered.

PiperOrigin-RevId: 561748634
2023-08-31 13:48:20 -07:00
Elliott Marquez
fcfc696c46 test(list,menu,select)!: clean up internal testing patterns from harnesses
lots of hard coded stuff to enable our tests. Cleaning this up for generalized client usage.

BREAKING CHANGE: menu harnesses will not automatically open menus in quick mode anymore and interactions in menu and list harnesses will not automatically go to the first item but rather the menu roots.

PiperOrigin-RevId: 561746073
2023-08-31 13:34:31 -07:00
Elliott Marquez
b9058076b6 fix(select, menu): allow item selection while animation is running in non-overflow contexts
PiperOrigin-RevId: 561466649
2023-08-30 15:25:49 -07:00
Elliott Marquez
5ba348dfd0 feat(menu)!: allow anchoring with idref string and set element ref on anchorElement
BREAKING: `MdMenu.prototype.anchor` now only accepts a string which will querySelector the rootNode of the menu. The method now to anchor to an element reference is to set `MdMenu.prototype.anchorElement`. This matches the `popover` anchoring proposal more closely, but that proposal may not pass in favor of a CSS approach.
PiperOrigin-RevId: 560955779
2023-08-29 01:40:36 -07:00
Andrew Jakubowicz
32a8c4410e fix(list,menu): restrict type to only supported aria roles
## Why?

Because currently `md-list` and `md-menu` can accept any aria role as a `type` property. However this can result in invalid roles being added, e.g. `progressbar` is allowed as a valid `type`.

Instead this change scopes the `type` to the following:
 - `<md-list>` `type` can be any of: `'menu'|'menubar'|'listbox'|'list'|''`.
 - `<md-menu>` `type` can be any of: `'menu'|'menubar'|'listbox'|'list'`.

PiperOrigin-RevId: 560180446
2023-08-25 13:27:21 -07:00
Elliott Marquez
626b4efd69 fix(menu): make overriding default styles less likely
fixes #4160

A workaround to lessen the likelihood of someone's styles clashing with the default light dom styles of md-menu and md-select. It's difficult to tell whether a slotted element will animate and fire animation events, so tihs is a bit of a workaround for now.

PiperOrigin-RevId: 558910594
2023-08-21 15:04:10 -07:00
Elliott Marquez
2d9352e3f4 refactor(list-item)!: remove duplicate list-item menu-item from custom prop names
BREAKING: renames custom props from this:

`--md-list-item-list-item-...`
`--md-menu-item-list-item-...`

to:
`--md-list-item-...`
`--md-menu-item-...`
PiperOrigin-RevId: 557337871
2023-08-15 20:48:25 -07:00
Elizabeth Mitchell
0e492ade43 chore: remove sass theme utilities
PiperOrigin-RevId: 556915539
2023-08-14 14:39:19 -07:00
Elizabeth Mitchell
0510496e60 chore: avoid this in static context
PiperOrigin-RevId: 554933524
2023-08-08 14:00:25 -07:00
Elliott Marquez
65d04a3cf3 feat(list,menu): add css shadow parts to sub components
PiperOrigin-RevId: 553896396
2023-08-04 13:25:32 -07:00
Elliott Marquez
09cb6da8fb refactor(list,menu)!: add href to (list|menu)-item and remove (menu|list)-item-link
BREAKING CHANGE: list-item-link and menu-item-link have been removed and their functionality has been added to menu-item and list-item respectively.

PiperOrigin-RevId: 553894393
2023-08-04 13:18:38 -07:00
Elliott Marquez
043d548270 refactor(menu)!: events no longer subclass Event but rather use CustomEvent
Fixes issues running in ES5

BREAKING CHANGE: subclassing events is not supported in ES5 so all menu-related events now use CustomEvent rather than subclassing Event

PiperOrigin-RevId: 553304128
2023-08-02 17:23:36 -07:00
Elliott Marquez
fa63178238 refactor(menu): remove :has selectors
PiperOrigin-RevId: 552615347
2023-07-31 15:54:20 -07:00
Elliott Marquez
86ccec3e7e build: use firebase for hosting and remove url prefixes 2023-07-27 09:17:27 -07:00
Elizabeth Mitchell
d49f9b89e4 fix(focus)!: rename import to md-focus-ring.ts
BREAKING CHANGE: Change `@material/web/focus/focus-ring.js` to `@material/web/focus/md-focus-ring.js`.

PiperOrigin-RevId: 550608428
2023-07-24 10:43:31 -07:00
Andrew Jakubowicz
a8c2fa9a8b fix(menu)!: rename "lib" directory to "internal"
BREAKING CHANGE: Rename `@material/web/menu/lib` to `@material/web/menu/internal`. Prefer not using internal files.

PiperOrigin-RevId: 550589890
2023-07-24 09:45:01 -07:00
Andrew Jakubowicz
c6e6f65445 fix(list)!: rename "lib" directory to "internal"
BREAKING CHANGE: Rename `@material/web/list/lib` to `@material/web/list/internal`. Prefer not using internal files.

PiperOrigin-RevId: 550585246
2023-07-24 09:29:15 -07:00
Andrew Jakubowicz
10f60d23e0 chore: rename e to event
PiperOrigin-RevId: 549039407
2023-07-18 10:16:37 -07:00
Elizabeth Mitchell
243e231a13 feat(all): expose focus-ring parts
PiperOrigin-RevId: 548873009
2023-07-17 20:28:04 -07:00
Elizabeth Mitchell
fd28dd1a5b chore(all): move focus tokens to focus ring element
PiperOrigin-RevId: 548872335
2023-07-17 20:24:46 -07:00
Elliott Marquez
0dfd2b841b test(list): increase test coverage for list and list-item
PiperOrigin-RevId: 544476519
2023-06-29 15:18:52 -07:00
Andrew Jakubowicz
3f22ed0391 fix(menu)!: rename typeaheadBufferDelay and list-tab-index for consistency
BREAKING_CHANGE: Renamed property `typeaheadBufferDelay` to `typeaheadDelay`, and attribute `list-tab-index` to `list-tabindex`.
PiperOrigin-RevId: 542685976
2023-06-22 15:36:13 -07:00
Elliott Marquez
d5035db0c4 fix(menu): close menu when escape is pressed on list root
PiperOrigin-RevId: 542325162
2023-06-21 12:07:47 -07:00
Elliott Marquez
30937acd18 feat(list,menu): expose activate next and prev items
PiperOrigin-RevId: 542315413
2023-06-21 11:33:26 -07:00
Elizabeth Mitchell
1790a5bbf8 chore: remove closure comments from static blocks
PiperOrigin-RevId: 539772537
2023-06-12 15:07:36 -07:00
Elizabeth Mitchell
0607d9ca53 chore: fix jscompiler issues
PiperOrigin-RevId: 539716693
2023-06-12 11:42:52 -07:00
Elliott Marquez
2be1b78241 feat(list): expose list item role
PiperOrigin-RevId: 538579598
2023-06-07 13:39:14 -07:00
Elizabeth Mitchell
a2bb8458d2 chore(sass): move to internal
PiperOrigin-RevId: 536458468
2023-05-30 11:23:00 -07:00
Elizabeth Mitchell
ed00d30b1d chore(motion): move to internal
PiperOrigin-RevId: 536448206
2023-05-30 10:50:00 -07:00
Elizabeth Mitchell
5efdc593fa chore(aria): move to internal
PiperOrigin-RevId: 536444453
2023-05-30 10:37:46 -07:00
Elizabeth Mitchell
a2a6ff442c chore: fix typos
PiperOrigin-RevId: 536443522
2023-05-30 10:34:25 -07:00
Bre 97
46611901c3 Update menu.ts
Modify the label name of md-sub-menu in example
2023-05-23 21:05:30 +08:00
Elizabeth Mitchell
4ddeee1a2e chore: remove types folder
PiperOrigin-RevId: 532095745
2023-05-15 06:51:39 -07:00
Elliott Marquez
dc49e0b518 docs: update playground urls to match new base-URI
PiperOrigin-RevId: 531322264
2023-05-11 15:24:11 -07:00
Elliott Marquez
5f80c096e0 refactor: remove extraneous file extensions
PiperOrigin-RevId: 531005525
2023-05-10 14:26:01 -07:00
Elliott Marquez
1cade43ccf refactor: remove extraneous file extensions
PiperOrigin-RevId: 530993820
2023-05-10 14:04:53 -07:00
Elizabeth Mitchell
beb5f816ea fix(tokens): bugs with component values() functions
PiperOrigin-RevId: 528870337
2023-05-02 13:19:18 -07:00
Elizabeth Mitchell
cc7bb6574b chore(list): remove strong focus
PiperOrigin-RevId: 527618343
2023-04-27 10:32:42 -07:00
Elliott Marquez
f6d72f9c3f fix(menu): fix submenu closing when already opened and all menus closing when hovering over menuitem
PiperOrigin-RevId: 527611715
2023-04-27 10:09:59 -07:00
Elizabeth Mitchell
db8ee4d1df chore: use private instead of protected
PiperOrigin-RevId: 527010546
2023-04-25 10:40:48 -07:00
Elizabeth Mitchell
7b52c4515f fix: remove @ariaProperty decorator
PiperOrigin-RevId: 526750432
2023-04-24 14:10:38 -07:00
Elizabeth Mitchell
0a35ff5042 fix: remove role attribute from elements
PiperOrigin-RevId: 526712160
2023-04-24 11:51:47 -07:00