Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch: Completely remove aria-checked from switch, set id on input to be the same as label, replace brittle unit test with more precise e2e test #2455

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

austinoneil
Copy link
Contributor

@austinoneil austinoneil commented Apr 20, 2024

Description

Completely remove aria-checked from switch, set id on input to be the same as label, replace brittle unit test with more precise e2e test

References #2450

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

https://deploy-preview-2455--moduswebcomponents.netlify.app/?path=/story/user-inputs-switch--medium

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Copy link

netlify bot commented Apr 20, 2024

Deploy Preview for moduswebcomponents ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6cba23c
🔍 Latest deploy log https://app.netlify.com/sites/moduswebcomponents/deploys/6639788277ad130008565e88
😎 Deploy Preview https://deploy-preview-2455--moduswebcomponents.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 26 (no change from production)
Accessibility: 98 (no change from production)
Best Practices: 92 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@austinoneil austinoneil changed the title Completely remove aria-checked from switch, set id on input to be the same as label, replace brittle unit test with more precise e2e test Switch: Completely remove aria-checked from switch, set id on input to be the same as label, replace brittle unit test with more precise e2e test Apr 22, 2024
@coliff coliff self-requested a review April 22, 2024 12:43
@coliff coliff added bug Something is wrong and needs to be addressed accessibility labels Apr 22, 2024
Copy link
Member

@coliff coliff left a comment

Choose a reason for hiding this comment

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

This will be great when it's finished - but it's not quite right yet.
image

  • The label is not matching the id.
  • When the switch is checked the input should have the checked attribute
  • id name should assigned automatically with something like mwc_id_0_switch_input like do for text-inputs (<label for="mwc_id_0_text_input">Username</label>)

@coliff coliff marked this pull request as draft April 22, 2024 14:25
@austinoneil
Copy link
Contributor Author

When the switch is checked the input should have the checked attribute
This issue is also present in main. It is definitely strange, as the checked attribute is added to the input element. I think this should be filed as an issue.

I've fixed the other two issues.

@coliff coliff self-requested a review April 28, 2024 07:22
@austinoneil austinoneil marked this pull request as ready for review May 5, 2024 06:49
@coliff coliff self-requested a review May 7, 2024 06:48
@coliff
Copy link
Member

coliff commented May 7, 2024

oh, found a bug. Clicking on the label should change the state like this:
https://modus.trimble.com/components/web/switches/#overview

@coliff coliff marked this pull request as draft June 19, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility bug Something is wrong and needs to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants