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

fix(many): hide required asterisks from screenreaders #1803

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion packages/ui-checkbox/src/Checkbox/CheckboxFacade/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const generateComponentTheme = (theme: Theme): CheckboxFacadeTheme => {
color: colors?.contrasts?.white1010,
borderWidth: borders?.widthSmall,
borderColor: colors?.contrasts?.grey3045,
errorBorderColor: colors?.ui?.textError,
errorBorderColor: colors?.contrasts?.red5782,
borderRadius: borders?.radiusMedium,
background: colors?.contrasts?.white1010,
marginRight: spacing?.xSmall,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-checkbox/src/Checkbox/ToggleFacade/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const generateComponentTheme = (theme: Theme): ToggleFacadeTheme => {

const componentVariables: ToggleFacadeTheme = {
color: colors?.contrasts?.white1010,
errorBorderColor: colors?.ui?.textError,
errorBorderColor: colors?.contrasts?.red5782,
background: colors?.contrasts?.grey1111,
borderColor: colors?.contrasts?.grey3045,
borderWidth: borders?.widthSmall,
Expand Down
16 changes: 14 additions & 2 deletions packages/ui-checkbox/src/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
>
{label}
{isRequired && label && (
<span css={this.invalid ? styles?.requiredInvalid : {}}> *</span>
<span
css={this.invalid ? styles?.requiredInvalid : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</ToggleFacade>
)
Expand All @@ -248,7 +254,13 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
>
{label}
{isRequired && label && (
<span css={this.invalid ? styles?.requiredInvalid : {}}> *</span>
<span
css={this.invalid ? styles?.requiredInvalid : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</CheckboxFacade>
)
Expand Down
8 changes: 7 additions & 1 deletion packages/ui-number-input/src/NumberInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,13 @@ class NumberInput extends Component<NumberInputProps, NumberInputState> {
<React.Fragment>
{rawLabel}
{isRequired && (
<span css={this.invalid ? styles?.requiredInvalid : {}}> *</span>
<span
css={this.invalid ? styles?.requiredInvalid : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</React.Fragment>
) : (
Expand Down
8 changes: 7 additions & 1 deletion packages/ui-radio-input/src/RadioInputGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ class RadioInputGroup extends Component<
<React.Fragment>
{description}
{isRequired && description && (
<span css={this.invalid ? styles?.invalidAsterisk : {}}> *</span>
<span
css={this.invalid ? styles?.invalidAsterisk : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</React.Fragment>
) : (
Expand Down
8 changes: 7 additions & 1 deletion packages/ui-text-area/src/TextArea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,13 @@ class TextArea extends Component<TextAreaProps> {
<React.Fragment>
{this.props.label}
{required && (
<span css={this.invalid ? styles?.requiredInvalid : {}}> *</span>
<span
css={this.invalid ? styles?.requiredInvalid : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</React.Fragment>
) : (
Expand Down
8 changes: 7 additions & 1 deletion packages/ui-text-input/src/TextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,13 @@ class TextInput extends Component<TextInputProps, TextInputState> {
<React.Fragment>
{rawLabel}
{isRequired && (
<span css={this.invalid ? styles?.requiredInvalid : {}}> *</span>
<span
css={this.invalid ? styles?.requiredInvalid : {}}
aria-hidden={true}
>
{' '}
*
</span>
)}
</React.Fragment>
) : (
Expand Down
Loading