Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc7786e7b14f7627a8f090ee72a997239e27c0d8
      
https://github.com/WebKit/WebKit/commit/bc7786e7b14f7627a8f090ee72a997239e27c0d8
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-10-10 (Sat, 10 Oct 2026)

  Changed paths:
    M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift

  Log Message:
  -----------
  [Text Extraction] Inline a button's leading text child onto its own line
https://bugs.webkit.org/show_bug.cgi?id=327023
rdar://189574376

Reviewed by Abrar Rahman Protyasha.

Buttons whose label is a leading text child followed by non-text siblings (e.g. 
accordion headers
with a heading, sub-label, and chevron image) previously serialized as a bare 
`button uid=N` line
with the heading on the next line. That detached the uid from its label, so 
weaker models that are
trying to reason about DOM hierarchy might end up confused about the purpose of 
the button.

Now, when a button/link has multiple children and no text already inlined, 
inline its first child
onto the button line when that child is a text node. Remaining children 
(sub-labels, icons) keep
their own lines, and redundant-text elision is preserved.

This turns:

┃  button uid=7757
┃      'CHANGE EMAIL'
┃      'Change the email address for your Fandango account'
┃      role=img label='collapsed section'
┃  button uid=7758
┃      'CHANGE PASSWORD'
┃      'Change the password for your Fandango account'
┃      role=img label='collapsed section'

...into a more compact output:

┃  button uid=7757 'CHANGE EMAIL'
┃      'Change the email address for your Fandango account'
┃      role=img label='collapsed section'
┃  button uid=7758 'CHANGE PASSWORD'
┃      'Change the password for your Fandango account'
┃      role=img label='collapsed section'

Test: TextExtractionTests/buttonInlinesLeadingTextChild()

* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::addTextRepresentationRecursive):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift:
(TextExtractionTests.buttonInlinesLeadingTextChild):

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



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

Reply via email to