Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d54c7c9abaaf749ea932f09a5aff6c752a8aa31
      
https://github.com/WebKit/WebKit/commit/9d54c7c9abaaf749ea932f09a5aff6c752a8aa31
  Author: Andres Gonzalez <[email protected]>
  Date:   2026-03-23 (Mon, 23 Mar 2026)

  Changed paths:
    A 
LayoutTests/accessibility/mac/set-selected-textmarker-range-textarea-in-iframe-expected.txt
    A 
LayoutTests/accessibility/mac/set-selected-textmarker-range-textarea-in-iframe.html
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp

  Log Message:
  -----------
  AX: AccessibilityRenderObject::setSelectedVisiblePositionRange fails for 
textarea inside iframe when called on the top-level web area.
https://bugs.webkit.org/show_bug.cgi?id=310387
<rdar://problem/173025927>

Reviewed by Joshua Hoffman.

When AXSelectedTextMarkerRange is set on a web area but the target position is
inside a textarea's shadow DOM (e.g. a textarea inside an iframe),
AccessibilityRenderObject::setSelectedVisiblePositionRange takes the
else-if-m_renderer branch. The contains<ComposedTree> check fails for
cross-document positions, clamping the selection to the web area start instead
of moving it into the textarea.

Fix by adding an enclosingTextFormControl fallback in
setSelectedVisiblePositionRange() when the target position is inside a native
text control but 'this' is not the text control itself (e.g. this is the web
area), delegate to the text control's setSelectionRange which handles the
selection correctly.

Test: accessibility/mac/set-selected-textmarker-range-textarea-in-iframe.html

* 
LayoutTests/accessibility/mac/set-selected-textmarker-range-textarea-in-iframe-expected.txt:
 Added.
* 
LayoutTests/accessibility/mac/set-selected-textmarker-range-textarea-in-iframe.html:
 Added.
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const):

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



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

Reply via email to