-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 properties can no longer be undefined in TypeScript 4.4+ #46554
Comments
I think this PR resulted in this behavior change: #44684 Going to test a change locally and will submit a new PR. |
Interestingly, |
Any PR regarding the DOM lib should be done in https://github.com/microsoft/TypeScript-DOM-lib-generator/. |
Thanks! I did not know that existed. Looks like there is a similar discussion going on at microsoft/TypeScript-DOM-lib-generator#1119. |
Ok looking into the issue in microsoft/TypeScript-DOM-lib-generator#1119 a bit more, I do not think this is a bug in TypeScript. The root issue here seems to be a mismatch between what the ARIA spec says and what the browsers actually do. It sounds like the behavior may change in the future according to microsoft/TypeScript-DOM-lib-generator#1119 (comment), but for now TypeScript's types for the aria properties are technically correct. This behavior change impacts Ionicons (ionic-team/ionicons#1011), but I think I am going to change the ariaHidden and ariaLabel properties on the icon component to always expect a value for now. I am going to close this out. Thanks! |
Maybe I've misunderstood something, but it looks like none of these definitions are sufficient - by default, a DOM node has
|
@DanielRosenwasser I think that's part of the problem. What the browsers do and what MDN says is different from what the spec wants. The initial value of
Chrome: |
Bug Report
π Search Terms
4.4 aria
aria property
aria undefined
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=4.4.4#code/JYOwLgpgTgZghgYwgAgLIE8DCBbADsiAD0hABMBnZAUQBsJsJxkBvAWAChkvk4pg4AEsFKlGAfgBcycmD4gA5gG4OAXyA
π» Code
π Actual behavior
TypeScript 4.4 says this is invalid usage:
π Expected behavior
I would expect this to compile without any errors. According to both MDN and the W3C ARIA Spec, ARIA properties such as
ariaHidden
can be'true' | 'false' | undefined
.The text was updated successfully, but these errors were encountered: