From 74c3b7fcc798f8aeef935409ea10d0b8411c602c Mon Sep 17 00:00:00 2001 From: James Scholes Date: Wed, 4 Dec 2024 17:37:54 -0600 Subject: [PATCH] Update setup scripts --- .../js/checkFirstRadioButtonAndSetFocusAfterRadioGroup.js | 5 ++--- .../js/checkFirstRadioButtonAndSetFocusBeforeRadioGroup.js | 5 ++--- .../js/checkThirdRadioButtonAndSetFocusAfterRadioGroup.js | 5 ++--- .../data/js/setFocusOnAndCheckFirstRadioButton.js | 6 +++--- .../data/js/setFocusOnFirstRadioButton.js | 6 +++--- .../setFocusOnFirstRadioButtonAndCheckSecondRadioButton.js | 6 +++--- .../data/js/setFocusOnSecondRadioButton.js | 6 +++--- .../setFocusOnSecondRadioButtonAndCheckFirstRadioButton.js | 6 +++--- .../data/js/setFocusOnThirdRadioButton.js | 6 +++--- 9 files changed, 24 insertions(+), 27 deletions(-) diff --git a/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusAfterRadioGroup.js b/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusAfterRadioGroup.js index 894034510..cdc638839 100644 --- a/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusAfterRadioGroup.js +++ b/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusAfterRadioGroup.js @@ -1,11 +1,10 @@ // sets the state of the first radio button to checked, and sets focus on a link after the radio group -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); -radios[0].classList.add('focus'); +radios[0].setAttribute('tabindex', '0'); radios[0].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[0].id); testPageDocument.querySelector('#afterlink').focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusBeforeRadioGroup.js b/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusBeforeRadioGroup.js index 7ff151290..bfed9d036 100644 --- a/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusBeforeRadioGroup.js +++ b/tests/radiogroup-roving-tabindex/data/js/checkFirstRadioButtonAndSetFocusBeforeRadioGroup.js @@ -1,12 +1,11 @@ // sets the state of the first radio button to checked, sets focus on a link before the radio group, and hides the group heading -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); -radios[0].classList.add('focus'); +radios[0].setAttribute('tabindex', '0'); radios[0].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[0].id); testPageDocument.querySelector('#beforelink').focus(); testPageDocument.querySelector('#group_label_1').style.display = 'none'; diff --git a/tests/radiogroup-roving-tabindex/data/js/checkThirdRadioButtonAndSetFocusAfterRadioGroup.js b/tests/radiogroup-roving-tabindex/data/js/checkThirdRadioButtonAndSetFocusAfterRadioGroup.js index ecec9d5be..bda73e5bf 100644 --- a/tests/radiogroup-roving-tabindex/data/js/checkThirdRadioButtonAndSetFocusAfterRadioGroup.js +++ b/tests/radiogroup-roving-tabindex/data/js/checkThirdRadioButtonAndSetFocusAfterRadioGroup.js @@ -1,11 +1,10 @@ // sets the state of the third radio button to checked, and sets focus on a link after the radio group -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); -radios[2].classList.add('focus'); +radios[2].setAttribute('tabindex', '0'); radios[2].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[2].id); testPageDocument.querySelector('#afterlink').focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnAndCheckFirstRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnAndCheckFirstRadioButton.js index 27fd78030..701cb61cc 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnAndCheckFirstRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnAndCheckFirstRadioButton.js @@ -1,11 +1,11 @@ // sets focus on the first radio button, and sets its state to checked -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[0].classList.add('focus'); +radios[0].setAttribute('tabindex', '0'); radios[0].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[0].id); -radioGroup.focus(); +radios[0].focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButton.js index 55c1e6996..16b349fd8 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButton.js @@ -1,11 +1,11 @@ // sets focus on the first radio button -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[0].classList.add('focus'); -radioGroup.setAttribute('aria-activedescendant', radios[0].id); +radios[0].setAttribute('tabindex', '0'); testPageDocument.querySelector('#group_label_1').style.display = 'none'; -radioGroup.focus(); +radios[0].focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButtonAndCheckSecondRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButtonAndCheckSecondRadioButton.js index b87205df4..36f66c7ae 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButtonAndCheckSecondRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnFirstRadioButtonAndCheckSecondRadioButton.js @@ -1,11 +1,11 @@ // sets focus on the first radio button, and checks the second radio button -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[0].classList.add('focus'); +radios[0].setAttribute('tabindex', '0'); radios[1].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[0].id); -radioGroup.focus(); +radios[0].focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButton.js index 40973694d..32c6c4847 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButton.js @@ -1,10 +1,10 @@ // sets focus on the second radio button -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[1].classList.add('focus'); -radioGroup.setAttribute('aria-activedescendant', radios[1].id); -radioGroup.focus(); +radios[1].setAttribute('tabindex', '0'); +radios[1].focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButtonAndCheckFirstRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButtonAndCheckFirstRadioButton.js index 97b478dc4..8470d7e7c 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButtonAndCheckFirstRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnSecondRadioButtonAndCheckFirstRadioButton.js @@ -1,11 +1,11 @@ // sets focus on the second radio button, and checks the first radio button -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[1].classList.add('focus'); +radios[1].setAttribute('tabindex', '0'); radios[0].setAttribute('aria-checked', 'true'); -radioGroup.setAttribute('aria-activedescendant', radios[1].id); -radioGroup.focus(); +radios[1].focus(); diff --git a/tests/radiogroup-roving-tabindex/data/js/setFocusOnThirdRadioButton.js b/tests/radiogroup-roving-tabindex/data/js/setFocusOnThirdRadioButton.js index c5dcfc593..45a6e8dec 100644 --- a/tests/radiogroup-roving-tabindex/data/js/setFocusOnThirdRadioButton.js +++ b/tests/radiogroup-roving-tabindex/data/js/setFocusOnThirdRadioButton.js @@ -1,10 +1,10 @@ // sets focus on the third radio button -let radioGroup = testPageDocument.querySelector('[role="radiogroup"]'); let radios = testPageDocument.querySelectorAll('[role="radio"]'); radios.forEach(r => { + r.setAttribute('tabindex', '-1'); r.setAttribute('aria-checked', 'false'); r.classList.remove('focus'); }); radios[2].classList.add('focus'); -radioGroup.setAttribute('aria-activedescendant', radios[2].id); -radioGroup.focus(); +radios[2].setAttribute('tabindex', '0'); +radios[2].focus();