-
Notifications
You must be signed in to change notification settings - Fork 536
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
Let aria-required be undefined if not passed #4058
Conversation
🦋 Changeset detectedLatest commit: 5888cfb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -144,7 +144,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>( | |||
onFocus={handleInputFocus} | |||
onBlur={handleInputBlur} | |||
type={type} | |||
aria-required={required ? 'true' : 'false'} | |||
aria-required={required} |
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.
We still use aria-required={required ? 'true' : 'false'}
on Radio and Checkbox. Should we update those as well? Or are we worried this could also break tests in dotcom?
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.
What are the broken tests?? 👀
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.
There are some tests in dotcom that compare the dom, so any additional props even when false fail CI 🤦
Ideally they should not depend on attributes from within primer components, but it's common :(
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.
Or are we worried this could also break tests in dotcom?
Only one way to find out, going to run the integration tests for this PR
Update: Seems like there are no new errors 🎉 https://github.com/github/github/actions/runs/7208501227/job/19637623263
size-limit report 📦
|
@@ -144,7 +144,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>( | |||
onFocus={handleInputFocus} | |||
onBlur={handleInputBlur} | |||
type={type} | |||
aria-required={required ? 'true' : 'false'} | |||
aria-required={required} |
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.
Just a quick question do we want to have aria-required="false"
if required is passed but as false? (Example usage)
Or do we only want to have aria-required
when it is only true?
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.
Or do we only want to have aria-required when it is only true?
yes :)
I asked Mike to create this PR because I found some snapshot tests in dotcom that compare the dom, so any additional props, even when false fail integration tests 🤦
@@ -144,7 +144,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>( | |||
onFocus={handleInputFocus} | |||
onBlur={handleInputBlur} | |||
type={type} | |||
aria-required={required ? 'true' : 'false'} | |||
aria-required={required} |
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.
What are the broken tests?? 👀
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.
Looks good, thanks!
Follow up to #4023
Does not pass
aria-required
attribute to input or textarea if it is undefined. This fixes some tests that were breaking in dotcom.Changelog
New
Changed
Before:
aria-required
is set to"false"
if therequired
prop is not passed toTextInput
orTextarea
.After:
aria-required
is not set at all if therequired
prop is not passed toTextInput
orTextarea
.Removed
Rollout strategy
Testing & Reviewing
Merge checklist