ax-role-inference-item-elementinternals-owner-implied.html (1669B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - ElementInternals radio item roles preserved (radiogroup mapping)</title> 4 <meta name="assert" content="ElementInternals supplied 'radio' roles must not be overridden by implied item mapping within a radiogroup focusgroup."> 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 <div id="rgOwner" focusgroup="radiogroup"> 11 <focusgroup-radio-internals id="radio1" tabindex="0"></focusgroup-radio-internals> 12 <focusgroup-radio-internals id="radio2" tabindex="-1"></focusgroup-radio-internals> 13 </div> 14 15 <script> 16 class FocusgroupRadioInternals extends HTMLElement { 17 constructor() { 18 super(); 19 this.internals_ = this.attachInternals(); 20 this.internals_.role = 'radio'; 21 this.textContent = 'Choice'; 22 } 23 } 24 customElements.define('focusgroup-radio-internals', FocusgroupRadioInternals); 25 </script> 26 27 <script> 28 if (!window.accessibilityController) { 29 test(() => { assert_true(true); }, 'accessibilityController not available (noop)'); 30 } else { 31 test(() => { 32 const radio1AX = accessibilityController.accessibleElementById('radio1'); 33 // Blink exposes ARIA role="radio" as AXRadioButton in the accessibility tree. 34 assert_equals(radio1AX.role, 'AXRole: AXRadioButton'); 35 const radio2AX = accessibilityController.accessibleElementById('radio2'); 36 assert_equals(radio2AX.role, 'AXRole: AXRadioButton'); 37 }, 'ElementInternals radio roles preserved (radiogroup case)'); 38 } 39 </script>