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

feat(web,a11y): slider accessibility improvements #8479

Merged
merged 13 commits into from
Apr 6, 2024

Conversation

ben-basten
Copy link
Member

@ben-basten ben-basten commented Apr 3, 2024

Description

Made the following accessibility changes to the Slider toggle component:

  1. Added a focus outline around the currently focused slider, to make it easier for users to track where they are on the page. The color of the outline is automatically determined by the browser and can vary - open to ideas if there's a specific color in mind.
  2. Linking labels to the slider using IDs, so screen readers will now announce the context that goes with it.

Screenshots

Expand for screenshots

Focused slider in dark mode (Firefox)

focus-dark

Focused slider in light mode (Firefox)

focus-light

How Has This Been Tested?

  • MacOS + VoiceOver
    • Chrome
    • Firefox
    • Safari
  • Windows + NVDA - don't have this setup yet
    • Chrome
    • Firefox

Try tabbing through a form with sliders, such as the "Create link to share" modal. There should be visible focus outlines around the slider.

Checklist:

  • npm run lint (linting via ESLint)
  • npm run format (formatting via Prettier)
  • npm run check:svelte (Type checking via SvelteKit)
  • npm test (unit tests)

@ben-basten ben-basten marked this pull request as ready for review April 3, 2024 01:40
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

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

LGTM

@mertalev
Copy link
Contributor

mertalev commented Apr 3, 2024

The outlines have some aliasing and color artifacts. Can we fix that?

Dark mode (left inner section):

outline-dark

Light mode (inner circle):

outline

@alextran1502
Copy link
Contributor

Can we please keep the slider's original styling?

@mertalev
Copy link
Contributor

mertalev commented Apr 3, 2024

I think it only changes the styling when the slider is focused. It makes it easier when you're tabbing through elements in the page, etc.

@ben-basten
Copy link
Member Author

The outlines have some aliasing and color artifacts. Can we fix that?

Yes, I'm seeing that too. I will do some investigation to see if there's a good solution for that.

@ben-basten
Copy link
Member Author

ben-basten commented Apr 3, 2024

The outlines have some aliasing and color artifacts. Can we fix that?

So I've been looking into this @mertalev . Some things I've tried:

  • adding a box shadow to fill the gap around the slider: no change
  • using border to indicate focus: removes the color artifacts, but feels weird because the border makes the slider look smaller
  • enlarging the slider, to see if the color artifacts are caused by how small the slider is: still seeing color artifacts when the slider is larger, see this screenshot where the circle is 40px by 40px for an example:

slider-outline-aliasing

So... the compromise solution I could think of is adding a subtle border in the same color as the background, to mask the color artifacting. It also has the added benefit of making the slider a little easier to see when it's focused, in my opinion.

What do you think about this solution?

Expand for screenshots

Dark Mode (Firefox)

slider-outline-dark

Light Mode (Firefox)

slider-outline-light

@mertalev
Copy link
Contributor

mertalev commented Apr 3, 2024

That looks a lot better! It's also good in that it increases contrast when the outline and slider are both gray.

@alextran1502 alextran1502 enabled auto-merge (squash) April 6, 2024 13:38
@alextran1502 alextran1502 merged commit 56d27bc into immich-app:main Apr 6, 2024
23 checks passed
@ben-basten ben-basten deleted the feat/slider-a11y branch April 6, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants