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

[Dropdown] [BUGFIX] Update aria-label logic #1953

Merged
merged 7 commits into from
Dec 11, 2024
Merged

Conversation

daniellewhyte
Copy link
Contributor

@daniellewhyte daniellewhyte commented Dec 5, 2024

Summary:

This PR contains two fixes for the aria-label in the dropdown widget:

  1. Change the logic of the aria label
    Follow up from Mark's comment on Add visible label and ARIA label to Dropdown widget #1845
    This commit ensures that the visible label does not override the aria label.
    Motivation: There may be additional info for the screen reader in the aria label that may not be in the visible label.

This changes also removes the aria-labelledby from the Dropdown which was causing the screen reader output to be garbled in Safari.

  1. Pass in a space (" ") for empty placeholder.
    Wonder Blocks adds a nbsp when an empty string is passed in as one of the option items. This does not work well with screen readers. When testing with Voice Over on Safari and Firefox, it reads out the space and the aria label as a series of characters (instead of words).
dropdown.aria.label.mov

The root cause for this should be fixed in Wonder Blocks and I’ve started a discussion with the WB team here (I haven't been able to find a solution in WB yet). Given that this bug exists on prod in webapp, it feels appropriate to go ahead and implement this fix in Perseus.

Issue: LIT-1476, LIT-1482

Test plan:

Test with the new Dropdown with empty placeholder story

  • Dropdown displays inline when nothing is selected
  • Screen reader does not say "space" when no option is selected. And does not spell out aria-label
fix.aria.label.safari.mov

@daniellewhyte daniellewhyte self-assigned this Dec 5, 2024
Copy link
Contributor

github-actions bot commented Dec 5, 2024

Size Change: +1 B (0%)

Total Size: 1.29 MB

Filename Size Change
packages/perseus/dist/es/index.js 425 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 77.9 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-editor/dist/es/index.js 697 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.7 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Dec 9, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (f09317a) and published it to npm. You
can install it using the tag PR1953.

Example:

yarn add @khanacademy/perseus@PR1953

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1953

@daniellewhyte daniellewhyte changed the title [Dropdown] Update aria-label logic [Dropdown] [BUGFIX] Update aria-label logic Dec 9, 2024
@daniellewhyte daniellewhyte marked this pull request as ready for review December 10, 2024 00:26
@daniellewhyte daniellewhyte requested a review from a team December 10, 2024 00:27
Copy link
Contributor

@mark-fitzgerald mark-fitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up with the WB team.

@daniellewhyte daniellewhyte merged commit acd8bd5 into main Dec 11, 2024
9 checks passed
@daniellewhyte daniellewhyte deleted the dropdown-label-logic branch December 11, 2024 16:59
daniellewhyte added a commit that referenced this pull request Dec 11, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @khanacademy/[email protected]

### Patch Changes

- [#1975](#1975)
[`335615bab`](335615b)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Make all types
in `perseus-types.ts` originate from it (no longer import Mafs types)


- [#1953](#1953)
[`acd8bd566`](acd8bd5)
Thanks [@daniellewhyte](https://github.com/daniellewhyte)! - [Dropdown]
Change logic for aria-label

## @khanacademy/[email protected]

### Patch Changes

- Updated dependencies
\[[`335615bab`](335615b),
[`acd8bd566`](acd8bd5)]:
    -   @khanacademy/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants