Commit 4df0e0f
fix(alert): change focused element and improve keyboard navigation (#30220)
Issue number: internal
## What is the current behavior?
> Once Alert gets open the focusable element was the ion-alert itself.
> <img width="279" alt="Screenshot 2025-02-27 at 18 07 19"
src="https://github.com/user-attachments/assets/50ad3b75-ba32-4dd1-b17e-c5a5bf16f93b"
/>
## What is the new behavior?
In order to mimick native alert a11y behaviour...
Changed the focused element based on the amount of existing buttons.
> If there is only 1 button, it should be that one focused
> <img width="304" alt="Screenshot 2025-02-27 at 18 04 52"
src="https://github.com/user-attachments/assets/e273f65a-5347-4a29-a156-f6e57852f0dc"
/>
> Otherwise it should focus the `.alert-wrapper` container
> <img width="284" alt="Screenshot 2025-02-27 at 18 05 02"
src="https://github.com/user-attachments/assets/4a8507f3-a31f-40b9-8cd7-478ec881e3ed"
/>
>
> **NOTE**: The yellow outline it's just for demo purposes, it was not
implemented 🤪
## Does this introduce a breaking change?
- [ ] Yes
- [X] No
## Other information
- Also updated support to the shiftTab keyboard navigation.
- Updated tests and screenshots with the latest changes.
---------
Co-authored-by: Maria Hutt <[email protected]>1 parent 2149ba2 commit 4df0e0f
File tree
54 files changed
+44
-14
lines changed- core/src/components/alert
- test
- a11y
- alert.e2e.ts-snapshots
- basic
- alert.e2e.ts-snapshots
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
54 files changed
+44
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
| |||
400 | 412 | | |
401 | 413 | | |
402 | 414 | | |
403 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
404 | 428 | | |
405 | 429 | | |
406 | 430 | | |
| |||
725 | 749 | | |
726 | 750 | | |
727 | 751 | | |
728 | | - | |
729 | 752 | | |
| 753 | + | |
730 | 754 | | |
731 | 755 | | |
732 | 756 | | |
| |||
739 | 763 | | |
740 | 764 | | |
741 | 765 | | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | 766 | | |
747 | | - | |
748 | 767 | | |
749 | 768 | | |
750 | 769 | | |
| |||
761 | 780 | | |
762 | 781 | | |
763 | 782 | | |
764 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
765 | 793 | | |
766 | 794 | | |
767 | 795 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments