Skip to content

Conversation

IsaDC
Copy link
Contributor

@IsaDC IsaDC commented Aug 25, 2025

@IsaDC IsaDC requested a review from mcking65 August 25, 2025 22:37
@IsaDC IsaDC self-assigned this Aug 25, 2025
@IsaDC IsaDC changed the title Thest plan for the Switch Example Using HTML Checkbox Input Test plan for the Switch Example Using HTML Checkbox Input Aug 25, 2025
@mcking65
Copy link
Contributor

@IsaDC

This plan is ready except for one problem: the setAttribute method call for setting aria-checked to 'true' is not working in the scripts for tests 2, 4, 6, and 8. I looked at the js in the generated HTML; it looks good to me. I don't know why setAttribute is not working.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howard-e

Do you see why the setAttribute specified on line 26 in this file is not setting aria-checked to 'true'?

Copy link
Contributor

@howard-e howard-e Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcking65 switch-checkbox is using <input type=checkbox> which controls it's own checked attribute. The other, switch and switch-button operated differently in being controlled by aria-checked. I'm thinking the following is what's wanted here:

const switchEl = testPageDocument.querySelector('[role="switch"]');
switchEl.checked = true;
switchEl.setAttribute('aria-checked', 'true');

edit: Going back through the roles guidance on the switch pattern page, thinking the switch-checkbox WAI example could be updated to include aria-checked to follow that guidance


striking below thought:

Commented aria-checked in the above snippet because it's not mentioned on the example page. Should it still be part of this setup script and assertions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants