Skip to content

Commit

Permalink
role=textbox elements should get InteractionRegions
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=267544
<rdar://117607868>

Reviewed by Anne van Kesteren.

Add `TextField` to the list of roles that can be used instead of
`cursor: pointer;`, this is what `role=textbox` maps to.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::shouldAllowAccessibilityRoleAsPointerCursorReplacement):
Add a `TextField` case.

* LayoutTests/interaction-region/aria-roles-expected.txt:
* LayoutTests/interaction-region/aria-roles.html:
Add a test covering this change.

Canonical link: https://commits.webkit.org/273055@main
  • Loading branch information
etiennesegonzac committed Jan 16, 2024
1 parent 3eabc15 commit 0b90437
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions LayoutTests/interaction-region/aria-roles-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Menu option 1
Menu option 2
Menu option 3
This works like a switch.
This behaves like a textbox
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 800.00 600.00)
Expand All @@ -28,6 +29,8 @@ This works like a switch.
(interaction (40,96) width=760 height=20)
(cornerRadius 8.00),
(interaction (0,132) width=800 height=20)
(cornerRadius 8.00),
(interaction (0,152) width=800 height=20)
(cornerRadius 8.00)])
)
)
Expand Down
1 change: 1 addition & 0 deletions LayoutTests/interaction-region/aria-roles.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<li role="option">Menu option 3</li>
</ul>
<div role="switch">This works like a switch.</div>
<div role="textbox">This behaves like a textbox</div>
<pre id="results"></pre>
<script>
document.body.addEventListener("click", function(e) {
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/page/InteractionRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static bool shouldAllowAccessibilityRoleAsPointerCursorReplacement(const Element
case AccessibilityRole::PopUpButton:
case AccessibilityRole::RadioButton:
case AccessibilityRole::Switch:
case AccessibilityRole::TextField:
case AccessibilityRole::ToggleButton:
return true;
default:
Expand Down

0 comments on commit 0b90437

Please sign in to comment.