-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Действительно, на Android в Talkback не видно фокуса при фокусировании на инпуте, потому что мы прячем этот инпут с помощью `VisuallyHidden` компонента. Как вариант можно убрать использование VisuallyHidden и спрятать компонент позади визульной части. Изменения: - Добавил модификатор для VisuallyHidden, когда речь идет о `Component=input`. Явно задал размер равный размеру родительского элемента, чтобы выделение визуально было подобно размеру switch. Но изменение затронуло не только Switch, но и другие компоненты, в которых `<VisuallyHidden Component="input" \>`. - добавил `role='switch'` - добавил `aria-checked`. Так как значение этого аттрибута должно соответствовать значению инпута, то добавил переменную состояния. - обновил пример в Storybook, добавив историю с испольованием SimpleCell чтобы как-то учесть пожелания из #4931
- Loading branch information
1 parent
52dab05
commit 84daced
Showing
6 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/vkui/src/components/VisuallyHidden/VisuallyHidden.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { baselineComponent } from '../../testing/utils'; | ||
import { VisuallyHidden } from './VisuallyHidden'; | ||
import styles from './VisuallyHidden.module.css'; | ||
|
||
describe('VisuallyHidden', () => { | ||
baselineComponent(VisuallyHidden); | ||
|
||
it('uses modifier to keep screen reader focus for input components', () => { | ||
const { rerender } = render(<VisuallyHidden data-testid="visually-hidden" />); | ||
|
||
const element = screen.getByTestId('visually-hidden'); | ||
expect(element).toHaveClass(styles['VisuallyHidden']); | ||
expect(element).not.toHaveClass(styles['VisuallyHidden--focusable-input']); | ||
|
||
rerender(<VisuallyHidden data-testid="visually-hidden" Component="input" />); | ||
const inputElement = screen.getByTestId('visually-hidden'); | ||
expect(inputElement).toHaveClass(styles['VisuallyHidden']); | ||
expect(inputElement).toHaveClass(styles['VisuallyHidden--focusable-input']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters