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

Add checked attribute to FormToggle. #1438

Merged
merged 4 commits into from
Jun 29, 2017

Conversation

afercia
Copy link
Contributor

@afercia afercia commented Jun 26, 2017

Looks like screen readers, and presumably also other software, rely on the checked attribute to correctly announce the checkboxes state. Please refer to the screenshots on the issue.

To test:

  • use Safari + VoiceOver (or Firefox+NVDA, IE11+JAWS on Windows)
  • focus the "Pending review" toggle, verify its state is reported correctly
  • change the toggle state using Spacebar, verify each time its state is reported correctly
  • repeat the previous steps on the 2 Discussions toggles (allow comments and pingbacks)

Fixes #1435

@mtias mtias added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Feature] Document Settings Document settings experience labels Jun 26, 2017
@@ -28,6 +28,7 @@ function FormToggle( { className, checked, id, onChange = noop, showHint = true
id={ id }
type="checkbox"
value={ checked }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should probably drop the value

@@ -17,15 +17,13 @@ describe( 'FormToggle', () => {
expect( formToggle.hasClass( 'components-form-toggle' ) ).to.be.true();
expect( formToggle.hasClass( 'is-checked' ) ).to.be.false();
expect( formToggle.type() ).to.equal( 'span' );
expect( formToggle.find( '.components-form-toggle__input' ).prop( 'value' ) ).to.be.undefined();
Copy link
Contributor

Choose a reason for hiding this comment

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

could we replace .prop( 'value' ) with .prop( 'checked' ) instead of dropping the assertions?

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Nide 👍 Thanks for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Settings Document settings experience [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants