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

Aperta
#5,485 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, html

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
C#
Stelle
4.9k
Fork
497
Merge medio
1g 1h
PR unite (30g)
47

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/fluentui-blazor

Tutte le issue di microsoft/fluentui-blazor

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.