-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
components/form-toggle/index.js
Outdated
@@ -28,6 +28,7 @@ function FormToggle( { className, checked, id, onChange = noop, showHint = true | |||
id={ id } | |||
type="checkbox" | |||
value={ checked } |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
…f-crash Fix(?) crash when removing media-text blocks
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:
Fixes #1435