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

Remove aria-hidden=true from spans with required asterisk #3320

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pink-beds-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Remove `aria-hidden=true` from `span`s with required asterisk
2 changes: 1 addition & 1 deletion src/_InputLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const InputLabel: React.FC<React.PropsWithChildren<Props>> = ({
{required ? (
<Box display="flex" as="span">
<Box mr={1}>{children}</Box>
<span aria-hidden="true">*</span>
<span>*</span>
</Box>
) : (
children
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/deprecated/InputField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import InputField from '../../deprecated/InputField'
expect.extend(toHaveNoViolations)

const TEXTINPUTFIELD_LABEL_TEXT = 'Name'
const TEXTINPUTFIELD_LABEL_TEXT_WITH_ASTERISK = 'Name *'
const TEXTINPUTFIELD_CAPTION_TEXT = 'Hint: your first name'
const TEXTINPUTFIELD_SUCCESS_TEXT = 'This name is valid'
const TEXTINPUTFIELD_ERROR_TEXT = 'This name is invalid'
Expand Down Expand Up @@ -66,7 +67,7 @@ describe('InputField', () => {
</SSRProvider>,
)

const input = getByRole('textbox', {name: TEXTINPUTFIELD_LABEL_TEXT})
const input = getByRole('textbox', {name: TEXTINPUTFIELD_LABEL_TEXT_WITH_ASTERISK})

expect(input.getAttribute('required')).not.toBeNull()
})
Expand Down