Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d5aba4a25f108940bf5ba0d920cf9d4acfb91656
      
https://github.com/WebKit/WebKit/commit/d5aba4a25f108940bf5ba0d920cf9d4acfb91656
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-08-12 (Wed, 12 Aug 2026)

  Changed paths:
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm

  Log Message:
  -----------
  [Text Extraction] Include form control element labels in interaction 
descriptions
https://bugs.webkit.org/show_bug.cgi?id=321614
rdar://184739834

Reviewed by Abrar Rahman Protyasha.

Text extraction surfaces the text of associated `label` elements for form 
controls (via
`labelText()`), but interaction descriptions only consult the `aria-label` and 
`label` content
attributes. A control labeled by a separate `<label for=…>` is therefore 
described as something like
`input under html` instead of `input labeled “Email address”`.

Fall back to associated label text when describing an element, keeping 
`aria-label` as the preferred
source. This is opt-in per call site, so that the descendant scan for 
`containing child labeled`
doesn't build a `LabelsNodeList` for every labelable descendant.

Test: TextExtractionTests.InteractionDescriptionIncludesAssociatedLabelText

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::normalizedLabelText):
(WebCore::TextExtraction::textDescription):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/319072@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to