-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARIA reflection polyfill contains non-standard props #2733
Comments
This issue has been linked to a new work item: W-10820032 |
Hm, just noticed Chrome 101 doesn't support |
Filed a bug on Chromium: https://crbug.com/1305421 |
FWIW I have suggested adding "string" versions of certain props, e.g. Admittedly this would solve our (speculative) polyfill problem, but I think there's also a good case regardless of that issue: w3c/aria#1732 (comment) |
I have an idea for how we can fix this:
#2 will work fine for the existing template compiler, because it only uses the property syntax for custom elements, not for built-in elements: return [
api_custom_element("x-cmp", _xCmp, {
props: {
ariaActiveDescendant: api_scoped_id("foo"),
ariaAtomic: "foo",
ariaAutoComplete: "foo",
ariaBusy: "foo",
// ...
},
key: 0,
}),
api_element("div", {
attrs: {
"aria-activedescendant": api_scoped_id("foo"),
"aria-atomic": "foo",
"aria-autocomplete": "foo",
"aria-busy": "foo",
// ...
},
key: 1,
}),
];
} We will have to apply the standard ones as well, to support Firefox (which still doesn't have ARIA reflection). On platform, we can still include the const div = document.createElement('div')
div.ariaActiveDescendant = 'foo' But this will at least allow us to remove the polyfill for off-platform use cases. |
That proposal sounds reasonable. Additionally, we could instrument those non-standard accessors installed on LightningElement so we know which one are used... and eventually remove them all, or some if they are not used at all. |
Unfortunately it would be tricky to remove the non-standard accessors on LightningElement, since it would also require changing the compiler. In the short term, I would be most interested in instruming the non-standard accessors on non-LightningElements, since that requires the global polyfills. (And global patches are scary. 😬) |
A related problem is that there are some newer ARIA properties that we do not support, either in the polyfill or on
I would prefer for us to get out of the business entirely of polyfilling these things. But it's not clear to me what we should do in the short term. |
Some ARIA properties should be reflected between props and attributes, e.g.:
We patch these on the global
Element
, to support the prop-to-attr mapping:lwc/packages/@lwc/shared/src/aria.ts
Lines 19 to 67 in d93e296
lwc/packages/@lwc/engine-dom/src/polyfills/aria-properties/polyfill.ts
Lines 62 to 69 in 2a9db6d
Browsers have been adding support for this reflection, which would allow us to remove the polyfill. (In Firefox it's behind a flag,
accessibility.ARIAReflection.enabled
.) Unfortunately, not everything we polyfill is actually supported in browsers:Click to see
In particular, these reflections are not supported:
ariaActiveDescendant
->aria-activedescendant
ariaControls
->aria-controls
ariaDescribedBy
->aria-describedby
ariaDetails
->aria-details
ariaErrorMessage
->aria-errormessage
ariaFlowTo
->aria-flowto
ariaLabelledBy
->aria-labelledby
ariaOwns
->aria-owns
We should either 1) remove these reflections from the polyfill, or 2) push browsers/specs to add them.
The text was updated successfully, but these errors were encountered: