Skip to content

Commit

Permalink
Remove aria-hidden=true from spans with required asterisk (#3320) (#3439
Browse files Browse the repository at this point in the history
)

* Remove aria-hidden=true from spans with required asterisk

* Create pink-beds-fetch.md

---------

Co-authored-by: Cole Bemis <colebemis@github.com>
  • Loading branch information
adrianababakanian and colebemis committed Jun 28, 2023
1 parent d59d9cb commit 5b0f6b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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
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
2 changes: 1 addition & 1 deletion src/internal/components/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

0 comments on commit 5b0f6b5

Please sign in to comment.