Summary: | AX: incorrect accessible name from multiple label elements | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Zoë Bijl <webkit> | ||||||||
Component: | Accessibility | Assignee: | Tyler Wilcock <tyler_w> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | aboxhall, andresg_22, apinheiro, cdumez, cfleizach, dmazzoni, esprehn+autocc, ews-watchlist, giacomo.petri, jcraig, jdiggs, kangil.han, samuel_white, thibaudcolas, tyler_w, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Attachments: |
|
The report is pretty clear as it is but I’ve had to discover and research this bug myself so adding the details here. Relevant specification on accessible name computation: https://www.w3.org/TR/html-aam-1.0/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-url-and-textarea-element Extract (matching what Zoë has reported): > Otherwise use the associated label element(s) accessible name(s) - if more than one label is associated; concatenate by DOM order, delimited by spaces. Real-world example of this bug if it helps: https://github.com/django/django/pull/14389, https://code.djangoproject.com/ticket/32338 *** Bug 254812 has been marked as a duplicate of this bug. *** Created attachment 467052 [details]
Patch
Created attachment 467053 [details]
Patch
Comment on attachment 467053 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=467053&action=review > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:248 > + return labels.isEmpty() ? nullptr : labels.first(); does labels.first() return nil if it's empty anyway? or does it crash (In reply to chris fleizach from comment #6) > Comment on attachment 467053 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=467053&action=review > > > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:248 > > + return labels.isEmpty() ? nullptr : labels.first(); > > does labels.first() return nil if it's empty anyway? or does it crash It would crash, as Vector::first() does an unchecked access into the vector. Committed 266151@main (3c4dcc0a6eb0): <https://commits.webkit.org/266151@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 467053 [details]. Woohoo, thank you! |
Created attachment 268138 [details] Error message mechanism with multiple labels When multiple <label> elements are associated with a label-able element, the accessible name should be the product of the text content of each of the labels concatenated by DOM source order and space separated. Expected result: All associated label elements are used, in DOM order, for name calculation. Actual result: Only the first associated label element that is encountered in the DOM is used for name calculation. Code example courtesy of Steve Faulkner.