Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b8175c8e661431d426d0ab8efe0459d8dd20c98b
      
https://github.com/WebKit/WebKit/commit/b8175c8e661431d426d0ab8efe0459d8dd20c98b
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-07-31 (Wed, 31 Jul 2024)

  Changed paths:
    M Source/WebCore/editing/TextIterator.h
    M Source/WebCore/html/HTMLInputElement.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SimulateClickOverText.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/click-targets.html

  Log Message:
  -----------
  Click simulation should be able to target clickable elements with matching 
accessibility labels
https://bugs.webkit.org/show_bug.cgi?id=277423
rdar://132902431

Reviewed by Abrar Rahman Protyasha.

When the target text passed to 
`simulateClickOverFirstMatchingTextInViewportWithUserInteraction`
does not match any visible text on the webpage, fall back to searching all 
hit-testable elements in
the viewport (using an area-based hit-test) for elements that have relevant 
accessibility labels
(`aria-label`) or semantically interesting DOM attributes (e.g. `value` for 
button inputs), which
match the target text.

* Source/WebCore/editing/TextIterator.h:
* Source/WebCore/html/HTMLInputElement.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::simulateClickOverFirstMatchingTextInViewportWithUserInteraction):

See above for more details. Also make a slight adjustment here to return `true` 
in the completion
handler, even if the event was not handled as a default action or prevented by 
the page. This is
because mouse or click events may still result in interesting changes on the 
page even if the event
is not prevented, so it's better to err on the side of not reporting an error 
if we do end up
dispatching synthetic events over a target element.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/SimulateClickOverText.mm:
(TestWebKitAPI::TEST(SimulateClickOverText, ClickTargets)):
(TestWebKitAPI::TEST(SimulateClickOverText, ClickTargetsAfterScrolling)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/click-targets.html:

Augment these two API tests to cover more scenarios, where the click targets 
are:
• `input` of type `"button"`.
• `input` of type `"submit"`.
• `div` with click handler and accessibility label.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to