fix: FluentColorPicker can't be used with the keyboard or a screen reader

Open
#5,485 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, html

Research direction

Start with the SwatchPalette and ColorWheel markup, then read FluentColorPicker.ts for the HsvSquare pointer handling. Check how the picker exposes its selected color and handles focus, then compare the proposed radio and slider patterns with the existing component behavior. Done means all three views support keyboard operation and expose their color or value and selection state to screen readers.

Written by the indexing model from the issue text.

Description

a11y

🐛 Bug Report

FluentColorPicker can only be used with a mouse, in its three views:

  • SwatchPalette: each color is a <div> with an @onclick handler, without tabindex, role or accessible name.
  • ColorWheel: each color is an SVG <polygon> with an @onclick handler, also without tabindex, role or name.
  • HsvSquare: the square and the hue bar are driven by pointer events in FluentColorPicker.ts, with no keyboard handling and no role.

So keyboard users can't reach or select a color, and screen readers don't announce the colors or the selected one. With FluentColorPickerInput, typing the hex value in the text field is the only keyboard alternative, and the popover content isn't usable.

💻 Repro or Code Sample

<FluentColorPicker @bind-SelectedColor="@color" />
<FluentColorPicker View="ColorPickerView.ColorWheel" @bind-SelectedColor="@color" />
<FluentColorPicker View="ColorPickerView.HsvSquare" @bind-SelectedColor="@color" />
  1. Open https://fluentui-blazor.net/ColorPicker (or /ColorPicker in the demo).
  2. Press Tab: the focus skips the palette, wheel and square.

🤔 Expected Behavior

  • SwatchPalette and ColorWheel: one tab stop for the picker, arrow keys to move between the colors, Enter / Space (or the move itself) to select, and the color name or value announced along with the selected state.
  • HsvSquare: the square and the hue bar can be changed with the arrow keys, and their values are announced.

😯 Current Behavior

None of the views can be focused or used with the keyboard, and nothing is exposed to screen readers.

💁 Possible Solution

  • SwatchPalette / ColorWheel: the radio group pattern: role="radiogroup" on the container (with an aria-label), role="radio" + aria-checked + aria-label (the hex value, e.g. "#FF0000") on each color, and a roving tabindex (only the selected color, or the first one, has tabindex="0"). The arrow keys move the focus in the grid (Left / Right in the row, Up / Down between rows) and select the color, like native radio buttons.
  • HsvSquare: the slider pattern: role="slider" with aria-valuenow / aria-valuetext on the hue bar, and on the square indicator (saturation with Left / Right, brightness with Up / Down, using a 2D slider described with aria-valuetext, e.g. "Saturation 80%, brightness 60%").

Questions before I send a PR:

  • Do you agree with the radio group pattern for the palette and the wheel?
  • Is the hex value fine as the accessible name, or do you want color names (which would need a list of localized names)?
  • Should the HsvSquare be a separate PR?

🌍 Your Environment

  • OS & Device: Windows 11 on PC
  • Browser: Microsoft Edge, Google Chrome
  • .NET and Fluent UI Blazor library Version: .NET 10, dev branch (v5)
Dominant language
C#
Stars
4.9k
Forks
497
Avg merge
1d 1h
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/fluentui-blazor

All issues in microsoft/fluentui-blazor

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.