commit a438b74afb3a64b139ed1479fe55d455cb5405d0
parent 46bef3984415b289d999198e7bab17b3b5a4bfa4
Author: Jacques Newman <janewman@microsoft.com>
Date: Thu, 6 Nov 2025 21:37:35 +0000
Bug 1997985 [wpt PR 55831] - [focusgroup] aria role inference for focusgroup owners., a=testonly
Automatic update from web-platform-tests
[focusgroup] aria role inference for focusgroup owners.
See the supported behaviors and mapping precedence in the explainer:
https://open-ui.org/components/scoped-focusgroup.explainer/#supported-behaviors
Aria issue: https://github.com/w3c/aria/issues/2602
Bug: 40210717
Change-Id: I1e2ec46842e17a742031ff3a039917e5d645ac72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7100038
Commit-Queue: Benjamin Beaudry <benjamin.beaudry@microsoft.com>
Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com>
Auto-Submit: Jacques Newman <janewman@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1539538}
--
wpt-commits: 0eb0416e4e60f26802bbf1c272adc9218e8b0f34
wpt-pr: 55831
Diffstat:
2 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/interaction/focus/focusgroup/tentative/ax-role-inference-owner-elementinternals.html b/testing/web-platform/tests/html/interaction/focus/focusgroup/tentative/ax-role-inference-owner-elementinternals.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: focusgroup - Owner implied AX role inference with ElementInternals author role</title>
+<meta name="assert" content="A focusgroup owner whose role is set via ElementInternals should preserve that author supplied role and not receive an implied focusgroup role.">
+<link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+<link rel="help" href="https://open-ui.org/components/scoped-focusgroup.explainer/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<!-- The custom element will set an explicit author role (list) via ElementInternals. -->
+<focusgroup-owner-internals id="fgInternals" focusgroup="toolbar">
+</focusgroup-owner-internals>
+
+<script>
+class FocusgroupOwnerInternals extends HTMLElement {
+ constructor() {
+ super();
+ this.internals_ = this.attachInternals();
+ // Role list should be preserved instead of implied toolbar.
+ this.internals_.role = 'list';
+ this.innerHTML = '<div tabindex="0">Item</div>';
+ }
+}
+customElements.define('focusgroup-owner-internals', FocusgroupOwnerInternals);
+</script>
+
+<script>
+if (!window.accessibilityController) {
+ test(() => { assert_true(true); }, 'accessibilityController not available (noop)');
+} else {
+ test(() => {
+ const ax = accessibilityController.accessibleElementById('fgInternals');
+ // Expect ElementInternals supplied list role, not implied toolbar role.
+ assert_equals(ax.role, 'AXRole: AXList');
+ }, 'ElementInternals author role is preserved over implied focusgroup role');
+}
+</script>
diff --git a/testing/web-platform/tests/html/interaction/focus/focusgroup/tentative/ax-role-inference-owner.html b/testing/web-platform/tests/html/interaction/focus/focusgroup/tentative/ax-role-inference-owner.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: focusgroup - Owner implied AX role inference</title>
+<meta name="assert" content="A generic focusgroup owner with a behavior token gets an implied minimum ARIA role; explicit and native roles are preserved.">
+<link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+<link rel="help" href="https://open-ui.org/components/scoped-focusgroup.explainer/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<!-- Generic container (no explicit or native role) should inherit implied toolbar role. -->
+<div id=fgGeneric focusgroup="toolbar"><button>Item</button></div>
+<!-- Explicit author role must win over implied role. -->
+<div id=fgExplicit role="list" focusgroup="toolbar"><div>Item</div></div>
+<!-- Native semantics (UL -> list) must win over implied role. -->
+<ul id=fgNative focusgroup="toolbar"><li>Item</li></ul>
+
+<script>
+if (!window.accessibilityController) {
+ test(() => { assert_true(true); }, 'accessibilityController not available (noop)');
+} else {
+ test(() => {
+ const ax = accessibilityController.accessibleElementById('fgGeneric');
+ assert_equals(ax.role, 'AXRole: AXToolbar');
+ }, 'Generic container focusgroup owner gets implied toolbar role');
+
+ test(() => {
+ const ax = accessibilityController.accessibleElementById('fgExplicit');
+ assert_equals(ax.role, 'AXRole: AXList');
+ }, 'Explicit author role is preserved over implied focusgroup role');
+
+ test(() => {
+ const ax = accessibilityController.accessibleElementById('fgNative');
+ assert_equals(ax.role, 'AXRole: AXList');
+ }, 'Native semantic list role is preserved over implied focusgroup role');
+}
+</script>