Bug 152663

Summary: AX: incorrect accessible name from multiple label elements
Product: WebKit Reporter: Zoë Bijl <webkit>
Component: AccessibilityAssignee: 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:
Description Flags
Error message mechanism with multiple labels
none
Patch
ews-feeder: commit-queue-
Patch none

Zoë Bijl
Reported 2016-01-03 08:39:35 PST
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.
Attachments
Error message mechanism with multiple labels (1.24 KB, text/html)
2016-01-03 08:39 PST, Zoë Bijl
no flags
Patch (35.17 KB, patch)
2023-07-15 15:57 PDT, Tyler Wilcock
ews-feeder: commit-queue-
Patch (38.05 KB, patch)
2023-07-15 18:36 PDT, Tyler Wilcock
no flags
Radar WebKit Bug Importer
Comment 1 2016-01-03 08:39:46 PST
Thibaud Colas
Comment 2 2021-06-16 01:28:28 PDT
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
Tyler Wilcock
Comment 3 2023-07-15 15:52:59 PDT
*** Bug 254812 has been marked as a duplicate of this bug. ***
Tyler Wilcock
Comment 4 2023-07-15 15:57:25 PDT
Tyler Wilcock
Comment 5 2023-07-15 18:36:03 PDT
chris fleizach
Comment 6 2023-07-18 14:19:45 PDT
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
Tyler Wilcock
Comment 7 2023-07-18 14:25:11 PDT
(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.
EWS
Comment 8 2023-07-18 19:03:31 PDT
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].
Zoë Bijl
Comment 9 2023-07-19 07:12:59 PDT
Woohoo, thank you!
Note You need to log in before you can comment on or make changes to this bug.