RESOLVED INVALID251383
Reflected ARIA properties should not treat setting undefined the same as null
https://bugs.webkit.org/show_bug.cgi?id=251383
Summary Reflected ARIA properties should not treat setting undefined the same as null
Nolan Lawson
Reported 2023-01-30 12:40:40 PST
Created attachment 464760 [details] Repro Safari Technology Preview version: Release 146 (Safari 15.4, WebKit 16614.1.14.10.6) Steps to reproduce: 1. Go to https://codepen.io/nolanlawson-the-selector/pen/OJwojEW What is the expected result? It should log "undefined" (the string). What happens instead? It logs null. Here is the minimal repro (same as in the CodePen): const div = document.createElement('div') div.ariaLabel = undefined console.log(div.ariaLabel) Per the ARIA spec [1], setting `null` on a reflected `aria*` property removes the associated `aria-` attribute (if it exists). However, it doesn't say anything about setting `undefined`. So in this case, setting `undefined` should presumably be treated the same as any other non-string value – i.e. it should be stringified: div.ariaLabel = undefined div.ariaLabel // 'undefined' div.getAttribute('aria-label') // 'undefined' Note that Chrome and Safari behave identically, and Firefox has not implemented ARIA reflection yet. More details are in the relevant ARIA bug [2]. I also filed a bug on Chromium [3]. [1]: https://w3c.github.io/aria/#enumerated-attribute-values-html [2]: https://github.com/w3c/aria/issues/1858 [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=1411465
Attachments
Repro (145 bytes, text/html)
2023-01-30 12:40 PST, Nolan Lawson
no flags
Radar WebKit Bug Importer
Comment 1 2023-01-31 13:04:18 PST
Nolan Lawson
Comment 2 2023-10-25 09:32:10 PDT
This issue can be closed per tentative resolution in https://github.com/w3c/aria/pull/2057. Once the spec is updated, WebKit's behavior will be correct per the spec.
Note You need to log in before you can comment on or make changes to this bug.