ax-role-inference-owner-elementinternals.html (1608B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Owner implied AX role inference with ElementInternals author role</title> 4 <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."> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> 6 <link rel="help" href="https://open-ui.org/components/scoped-focusgroup.explainer/"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <!-- The custom element will set an explicit author role (list) via ElementInternals. --> 11 <focusgroup-owner-internals id="fgInternals" focusgroup="toolbar"> 12 </focusgroup-owner-internals> 13 14 <script> 15 class FocusgroupOwnerInternals extends HTMLElement { 16 constructor() { 17 super(); 18 this.internals_ = this.attachInternals(); 19 // Role list should be preserved instead of implied toolbar. 20 this.internals_.role = 'list'; 21 this.innerHTML = '<div tabindex="0">Item</div>'; 22 } 23 } 24 customElements.define('focusgroup-owner-internals', FocusgroupOwnerInternals); 25 </script> 26 27 <script> 28 if (!window.accessibilityController) { 29 test(() => { assert_true(true); }, 'accessibilityController not available (noop)'); 30 } else { 31 test(() => { 32 const ax = accessibilityController.accessibleElementById('fgInternals'); 33 // Expect ElementInternals supplied list role, not implied toolbar role. 34 assert_equals(ax.role, 'AXRole: AXList'); 35 }, 'ElementInternals author role is preserved over implied focusgroup role'); 36 } 37 </script>