Commit Graph

73 Commits

Author SHA1 Message Date
Elizabeth Mitchell
5df9410e60 fix!: aria-labels announcing twice with "group" on components
BREAKING CHANGE: `querySelector` for `[role]` and `[aria-*]` attributes may no longer work. See `@material/web/migrations/v2/README.md` and `@material/web/migrations/v2/query-selector-aria.ts`.

Browser/SR test results (go/mwc-double-aria-test-results)
  -  VoiceOver on Chrome
  -  VoiceOver on iOS Safari
  -  TalkBack on Chrome
  -  ChromeVox on Chrome
  -  NVDA on Chrome
  -  NVDA on Firefox
  -  JAWS on Chrome
  -  JAWS on Firefox
  (Optional)
  -  VoiceOver on Safari
  -  VoiceOver on Firefox

PiperOrigin-RevId: 648859827
2024-07-02 15:22:12 -07:00
Copybara-Service
e77ce061b6 Merge pull request #5606 from Dakotys:main
PiperOrigin-RevId: 630217008
2024-05-02 16:51:32 -07:00
Jaroslav Rojík
c377bf1d41
Update _shared.scss 2024-05-02 19:23:24 +02:00
Jaroslav Rojík
5efbe20d09
Update _shared.scss 2024-05-02 16:25:55 +02:00
Elizabeth Mitchell
1e47fd7383 fix(typography): rename md-typescale.js to md-typescale-styles.js
Fixes #5524

This fixes the new md-typescale file not being published. Our build assumes CSS-to-JS files end in "-styles".

This isn't a breaking change since the typescale classes haven't been published yet.

PiperOrigin-RevId: 617613456
2024-03-20 13:43:26 -07:00
Elizabeth Mitchell
36dd77ef97 feat(typography): add @material/web/typography/md-typescale classes
Fixes #1050

View the updated [typography docs](https://github.com/material-components/material-web/blob/main/docs/theming/typography.md#classes) for more info.

PiperOrigin-RevId: 613259080
2024-03-06 10:14:34 -08:00
Elliott Marquez
758e61581e fix(button,fab,chips,labs): text-transform inherits through shadow root
PiperOrigin-RevId: 612948745
2024-03-05 13:24:40 -08:00
Elliott Marquez
b74e3dd2e3 fix(elevation): expose md-elevation ::part in all components
PiperOrigin-RevId: 612946796
2024-03-05 13:18:05 -08: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
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
Copybara-Service
97c2e84d90 Merge pull request #5463 from CarlosEGuerraSilva:main
PiperOrigin-RevId: 608764139
2024-02-20 15:37:34 -08:00
Carlos Guerra
fb086bbd35 fix(labs): hasConstructed and constructor deprecated, changing tabIndex update in connectedCallback 2024-02-15 20:35:57 -06:00
Carlos Guerra
ea518d0353 fix(labs): removing hasConstructed and setting privateIsConstructed to handle setting tabIndex 2024-02-15 01:38:19 -06:00
Carlos Guerra
a6b8c09026 fix(labs): update tabIndex once the element is connected to the DOM
Fix for #5398 , when hydrating tabIndex on radios and tabs, it causes a DOMException. The proposed solution suggests moving the hasConstructed property and calling the updateTabIndex method in the connectedCallback to be able to modify the tabIndex as soon as the element is connected to the DOM
2024-02-13 19:17:46 -06:00
Elizabeth Mitchell
5e40a1bcec chore: create shape logical tokens in Sass component token files
Adds `@material/web/tokens/internal/shape` to take a shape token and create 4 logical tokens from its value.

All components' logical shape tokens are now generated by the token files themselves, rather than added in each component's styles.

PiperOrigin-RevId: 601783846
2024-01-26 09:13:58 -08: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
7dd7a68ae9 fix: forms correctly focus the first invalid control instead of last
Previously all text fields would focus themselves when the form reports validity, meaning the last one got focus. In reality, reportValidity is supposed to focus the first invalid control.

I added a "call" method wrapper around the `onReportValidity` callback that handles focusing logic.

PiperOrigin-RevId: 597904790
2024-01-12 11:43:47 -08:00
Elizabeth Mitchell
3151fd8d90 fix(textfield): error styles not removing when an unrelated control is invalid
The bug: given a form with two required text fields,
1. Try to submit the form, both fields show error.
2. Add a value to the first field.
3. Try to submit the form, the first field does not remove its error.

This is fixed by listening to form submits and clearing the error state if the control is valid.

I refactored `injectFormReportValidityHooks()` into `addFormReportValidListener()` to keep the `OnReportValidity` class cleaner and better identify the problem we're trying to solve.

PiperOrigin-RevId: 597664564
2024-01-11 15:06:22 -08:00
Elizabeth Mitchell
f2ebcdac79 chore(labs): fix onReportValidity called twice with form.reportValidity
PiperOrigin-RevId: 597661314
2024-01-11 14:53:43 -08:00
Elizabeth Mitchell
5c22b2baea test(labs): add more report validity tests
PiperOrigin-RevId: 597598077
2024-01-11 10:47:52 -08:00
Elizabeth Mitchell
e44f6a5a7f test(labs): re-organize report validity tests for unhandled use cases
PiperOrigin-RevId: 597596342
2024-01-11 10:42:11 -08:00
Elizabeth Mitchell
363fc054d3 chore: remove un-actionable todos from labs
PiperOrigin-RevId: 594112463
2023-12-27 15:49:30 -08:00
Elizabeth Mitchell
9973b90981 fix(textfield): counter showing when max length is 0 or removed
Fixes #4998

This also fixes an error being thrown in text field's validator when minlength/maxlength change to out of bounds if they're not set in the correct order.

PiperOrigin-RevId: 594013553
2023-12-27 08:13:58 -08:00
Elizabeth Mitchell
9c5cff8f90 fix(labs): card content not clickable with outline fix
Fixes #5312

PiperOrigin-RevId: 592594621
2023-12-20 10:20:39 -08:00
Elizabeth Mitchell
53ec44b4b8 fix(labs): add card support for high contrast mode
PiperOrigin-RevId: 591038474
2023-12-14 13:38:48 -08:00
Elizabeth Mitchell
2234a1279f chore: fix formAssociated disabled attribute not working
There is out-of-sync state when lit's built-in accessor tries to reflect attributes alongside the getter and setter. Instead, the properties just read from attributes and requestUpdate is called when those attributes change.

PiperOrigin-RevId: 590710159
2023-12-13 14:17:48 -08:00
Elizabeth Mitchell
a0baa4dc10 chore(card): remove host padding and update demo
Cards often have content that extends to the bounds of the card. Instead of adding default padding that must be removed, cards' content should add their own padding as needed.

This makes adding full-width media and dividers easier.

Also moved background z-indices to -1 since the slot doesn't have a display and the z-index wasn't doing anything.

PiperOrigin-RevId: 587883362
2023-12-04 16:58:37 -08:00
Elizabeth Mitchell
52e568ddc8 refactor(text-field): add validator and use validity mixins
PiperOrigin-RevId: 587086864
2023-12-01 12:32:30 -08:00
Elizabeth Mitchell
c53a4194e9 fix(behaviors): validation not reporting when form tries to submit
We handle `form.reportValidity()` with hooks, but we weren't handling `form.submit()`.

PiperOrigin-RevId: 586813244
2023-11-30 15:59:32 -08:00
Elizabeth Mitchell
6a5a245824 chore(behaviors): tabindex attribute not hydrating properly
On construction, setting `tabIndex = 0` should hydrate a tabindex attribute. This behavior was lost since we overrode `Element.prototype.tabIndex`. This change keeps the platform getter/setter behavior and calls requestUpdate another way.

PiperOrigin-RevId: 586738747
2023-11-30 11:33:41 -08:00
Elizabeth Mitchell
36aed9a2df chore(behaviors): update validity anchor on first render
This is needed specifically for text fields. There appears to be an odd Chrome/Safari issue where an element that `delegatesFocus: true` to an inner `<input>` MUST provide that input as the validity anchor. Otherwise, when a form submits or calls `form.reportValidity()`, an error will be thrown.

See https://lit.dev/playground/#gist=6c26e418e0010f7a5aac15005cde8bde for a reproduction.

Unfortunately I couldn't programmatically trigger this behavior in a jasmine test.

PiperOrigin-RevId: 586723140
2023-11-30 10:43:41 -08:00
Elizabeth Mitchell
636a68cfa1 chore(behaviors): don't spread validator state copies
PiperOrigin-RevId: 586487459
2023-11-29 16:36:17 -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
Elizabeth Mitchell
b5686ea4e0 feat(radio): add required constraint validation
Fixes #4316

PiperOrigin-RevId: 586045132
2023-11-28 11:15:20 -08:00
Elizabeth Mitchell
33c1afece2 refactor(select): use shared validation mixins
PiperOrigin-RevId: 585751913
2023-11-27 13:56:46 -08:00
Elizabeth Mitchell
21432b349f chore(behaviors): add mixinOnReportValidity for text field validation styling
PiperOrigin-RevId: 585698467
2023-11-27 10:51:20 -08:00
vdegenne
e4728bd018 fix(segmented-button): make tap highlight transparent 2023-11-22 10:08:10 +01:00
Elizabeth Mitchell
f7a66a8bbe refactor: add constraint validation mixin
This reduces the copy/paste of validation code. Constraint validation must be synchronous, so a `Validator` helps compute the validity and cache it since the validity must be checked when properties change.

Implemented in checkbox-like controls.

PiperOrigin-RevId: 584380464
2023-11-21 11:22:03 -08:00
Elizabeth Mitchell
8eb1f30e6f refactor: add checkbox validator
Part of adding constraint validation mixins. Each component that participates in constraint validation has different rules and error messages for validating. The `Validator` gives `mixinConstraintValidation()` a way to compute and cache validation.

Other validators will be added later, such as `SelectValidator` and `RadioValidator`

PiperOrigin-RevId: 583508468
2023-11-17 15:59:38 -08:00
Elliott Marquez
2adcb1479a docs: document events in jsdoc
PiperOrigin-RevId: 581041601
2023-11-09 15:25:21 -08:00
Elizabeth Mitchell
1f55d4111f chore(behaviors): update form controls to use shared mixins
PiperOrigin-RevId: 578297611
2023-10-31 14:08:39 -07:00
Elizabeth Mitchell
e7bc633e18 chore(behaviors): add ElementInternals mixin
PiperOrigin-RevId: 576937116
2023-10-26 11:31:33 -07:00
Elizabeth Mitchell
0ebd7c786b chore(card): add styles and tests
PiperOrigin-RevId: 576660710
2023-10-25 15:19:48 -07:00
Elizabeth Mitchell
cbcb89115f chore(card): add basic demo page
PiperOrigin-RevId: 576657778
2023-10-25 15:10:01 -07:00
Elizabeth Mitchell
1b39ab74ce chore(card): add Sass theming apis
PiperOrigin-RevId: 576653714
2023-10-25 14:57:34 -07:00
Elizabeth Mitchell
dcfd35a7a3 chore(card): add boilerplate files
PiperOrigin-RevId: 576646068
2023-10-25 14:31:37 -07:00
Elizabeth Mitchell
c390291687 chore: format files with prettier
PiperOrigin-RevId: 576601342
2023-10-25 11:59:00 -07:00
Elizabeth Mitchell
d1ef1febb6 fix(behaviors): add focusable behavior to labs
PiperOrigin-RevId: 575902929
2023-10-23 12:57:14 -07:00
vdegenne
56070593ce fix(md-item): exclude start slot from hidden overflow 2023-09-27 18:51:28 +02:00