Skip to content

Commit

Permalink
Merge branch 'develop' into feat/fix-switch-in-forced-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentSmedinga authored Aug 24, 2024
2 parents 65b6900 + 339bd1e commit c779e99
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/css/src/components/checkbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ It is written in the first person when asking the user to agree to the terms and

- [WCAG 1.3.5](https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html): It is clear for both users and programmatically what the purpose of a form field is.

Checkbox is an interactive element; therefore, [the general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
Checkbox is an interactive element, and the [general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
2 changes: 1 addition & 1 deletion packages/css/src/components/page-menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Check out the [developer guide](/docs/docs-developer-guide-routing-libraries--do

- [Consistent Navigation (Level AA)](https://www.w3.org/WAI/WCAG21/Understanding/consistent-navigation.html)

PageMenu is an interactive element, and the [general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
Page Menu is an interactive element, and the [general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
2 changes: 1 addition & 1 deletion packages/css/src/components/password-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Helps users enter a password.
It ensures that the input is not readable by others who might be looking at the screen.
- The characters entered are hidden, represented by squares.

This component sets `autocapitalize="none"`, `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
This component sets `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
Passwords shouldn’t be checked for spelling or grammar.
This may also prevent posting the password to third-party plugins.
These props cannot be overridden.
Expand Down
2 changes: 1 addition & 1 deletion packages/css/src/components/search-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ These features can be disruptive for a user searching for part of a word, and `a
- [WCAG 1.3.5](https://www.w3.org/TR/WCAG22/#identify-input-purpose): It is clear both to the user and programmatically what the purpose of a form field is.
- [WCAG 2.4.6](https://www.w3.org/TR/WCAG22/#headings-and-labels): There is a label describing the purpose of the input.

Search Field is an interactive element; therefore, [the general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
Search Field is an interactive element, and the [general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.
4 changes: 2 additions & 2 deletions packages/css/src/components/switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ A switch applies to a page or the entire system, such as an on/off switch.

## Guidelines

- A Switch must have a label, and in most cases, this label should be visible.
- Switch only between two different states.
It is a binary action.
- Use labels with a switch to make the action clear.
- The action takes place immediately when the user operates the switch.

## Relevant WCAG requirements

- [WCAG 1.3.5](https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html): it is both clear for a user and programmatically what the purpose of a form field is.

Switch is an interactive element; general requirements and guidelines for interactivity apply [here](/docs/docs-developer-guide-interactivity--docs).
Switch is an interactive element, and the [general requirements and guidelines for interactivity](/docs/docs-developer-guide-interactivity--docs) apply.

## References

Expand Down
8 changes: 8 additions & 0 deletions packages/css/src/components/tabs/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
&:disabled {
color: var(--ams-tabs-button-disabled-color);
cursor: var(--ams-tab-button-disabled-cursor);

@media (forced-colors: active) {
color: GrayText;
}
}

&:hover:not([aria-selected="true"], [disabled]) {
Expand All @@ -48,5 +52,9 @@
&[aria-selected="true"] {
background-color: var(--ams-tabs-button-selected-background-color);
color: var(--ams-tabs-button-selected-color);

@media (forced-colors: active) {
background-color: SelectedItem;
}
}
}
2 changes: 1 addition & 1 deletion packages/css/src/components/text-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A form field in which a user can enter text.
- Do not use a Text Input when users could provide more than 1 sentence of text.
- The width of the Text Input should be appropriate for the information to be entered.
- A Text Input must have a Label, and in most cases, this label should be visible.
- Use `spellcheck="false"` for fields that may contain sensitive information, such as passwords and personal data.
- Use `spellcheck="false"` for fields that may contain sensitive information, such as personal data.
Some browser extensions for spell-checking send this information to external servers.
- Apply automatic assistance where possible.
For example, in logged-in systems, pre-filling known values can prevent errors and save time.
3 changes: 1 addition & 2 deletions packages/react/src/PasswordInput/PasswordInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ describe('Password input', () => {
expect(component).toHaveClass('ams-password-input extra')
})

it('renders three attributes for privacy', () => {
it('renders two attributes for privacy', () => {
const { container } = render(<PasswordInput />)

const component = container.querySelector(':only-child')

expect(component).toHaveAttribute('autocapitalize', 'none')
expect(component).toHaveAttribute('autocorrect', 'off')
expect(component).toHaveAttribute('spellcheck', 'false')
})
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/PasswordInput/PasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const PasswordInput = forwardRef(
<input
{...restProps}
aria-invalid={invalid || undefined}
autoCapitalize="none"
autoCorrect="off"
className={clsx('ams-password-input', className)}
dir={dir ?? 'auto'}
Expand Down
4 changes: 0 additions & 4 deletions storybook/src/components/Switch/Switch.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import README from "../../../../packages/css/src/components/switch/README.md?raw

<Markdown>{README}</Markdown>

It can be used as a standalone component or as a form control element.
When used as a standalone component provide an `aria-label` or `aria-labelledby` prop to keep it accessible.
When used as a formcontrol, make sure to add the associated `<Label>` component.

<Primary />

<Controls />
Expand Down
9 changes: 1 addition & 8 deletions storybook/src/components/Switch/Switch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const meta = {
disabled: false,
},
argTypes: {
'aria-label': {
description: 'Describes the control.',
},
checked: {
description: 'Whether the control is initially checked.',
},
Expand All @@ -45,11 +42,7 @@ export default meta

type Story = StoryObj<typeof meta>

export const Default: Story = {
args: {
'aria-label': 'Default',
},
}
export const Default: Story = {}

export const WithLabel: Story = {
decorators: [
Expand Down
4 changes: 2 additions & 2 deletions storybook/src/components/TextInput/TextInput.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ On some devices, it may show an email-specific keyboard.
Consider setting the following attributes:

1. Set `autocomplete="email"` to help browsers autofill the user’s email address.
2. Set `autocapitalize="none"`, `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
2. Set `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
Email addresses shouldn’t be checked for spelling or grammar.
This may also prevent posting the email address to third-party plugins.

Expand All @@ -46,7 +46,7 @@ On some devices, it may show a URL-specific keyboard to aid in entering web addr
Consider setting the following attributes:

1. Set `autocomplete="url"` to help browsers autofill the user’s web address.
2. Set `autocapitalize="none"`, `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
2. Set `autocorrect="off"` and `spellcheck="false"` to stop browsers automatically changing user input.
Email addresses shouldn’t be checked for spelling or grammar.
This may also prevent posting the web address to third-party plugins.

Expand Down

0 comments on commit c779e99

Please sign in to comment.