fix: Prevent ariaLabel on code editor from conflicting with ace's built-in aria-label
Description
We're overriding ace's built-in aria-label by using our own aria-labelledby, which is a property not touched by ace. Ace's built-in aria-label provides cursor information, so we need to fetch and include that information ourselves. After consulation, using aria-describedby to provide the label has been ruled out, so we have to go with this approach. A number of other alternatives (using setMessages, using the groupAriaLabel instead of the textarea, etc.) have also been ruled out.
Important: The strings are being translated now, and they'll be included in a separate PR, but merged at this same time as this one.
Related links, issue #, if available: AWSUI-24619
API changes
- New
i18nStringsproperty for code editor:cursorPositionAriaLabel- Expected usage:
cursorPositionAriaLabel: row => 'Cursor at row ' + row - This string is combined with the ariaLabel.
- The idea is that we release with
I18nProvidersupport from the very beginning, so it's a no-touch upgrade for all internationalization users, and even if they don't, having a workingariaLabelis a better alternative than just getting just the cursor position (but obviously, both would be great).
- Expected usage:
How has this been tested?
Updated relevant tests.
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
- Changes include appropriate documentation updates.
- Changes are backward-compatible if not indicated, see
CONTRIBUTING.md. - Changes do not include unsupported browser features, see
CONTRIBUTING.md. - Changes were manually tested for accessibility, see accessibility guidelines.
Security
- If the code handles URLs: all URLs are validated through the
checkSafeUrlfunction.
Testing
- Changes are covered with new/existing unit tests?
- Changes are covered with new/existing integration tests?
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.34%. Comparing base (
0a7c2fe) to head (6403531). Report is 36 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2123 +/- ##
==========================================
+ Coverage 95.16% 95.34% +0.17%
==========================================
Files 685 687 +2
Lines 18350 18386 +36
Branches 6124 6153 +29
==========================================
+ Hits 17463 17530 +67
+ Misses 828 802 -26
+ Partials 59 54 -5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Superceded by #2282