Repository navigation
fix(dropdown-select): make readonly prevent opening and changing the value - #2568
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The readonly guard prevents dismissal of an already-open dropdown, and readonly fields with a non-first selection lack a keyboard focus outline.
2 open issues
What changed in this PR
Implements readonly behavior for scale-dropdown-select, addressing #2544 by blocking user interaction and adding read-only styling while preserving tab access.
Changes:
- Guards opening, keyboard actions, and option selection when read-only.
- Adds
aria-readonly, read-only colors, and hover-style exclusions. - Adds three tests covering tab order, accessibility attributes, and blocked mouse and keyboard interaction.
| File | Description |
|---|---|
packages/components/src/components/dropdown-select/dropdown-select.tsx |
Adds read-only interaction guards and the ARIA attribute. |
packages/components/src/components/dropdown-select/dropdown-select.spec.ts |
Tests read-only accessibility and interaction behavior. |
packages/components/src/components/dropdown-select/dropdown-select.css |
Adds read-only styling and suppresses hover and active effects. |
Review effort: Balanced
|
Hi @amir-ba, a gentle nudge on this one when you have a moment. It's still up to date with main, merges cleanly, and the checks pass. Happy to change anything. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
amir-ba
left a comment
There was a problem hiding this comment.
LGTM, I added a simple fix to have the storybook docs also allow toggling this .
I will merge when pipeline finishes
|
Thanks @amir-ba for the review, the merge, and for extending the Storybook docs so the toggle can be tried there too. |

Fixes #2544
@maomaoZH @amir-ba could one of you review this?
readonlyonscale-dropdown-selectwas accepted but never implemented. With this change a read-only dropdown:setOpen()refuses to open forreadonly. It can still close, so blur works even ifreadonlyis set while the list is openhandleKeyDownreturns after emittingscale-keydown, so arrow keys, Enter, Space, Home/End and type-to-select do nothinghandleOptionClickchecksreadonlyas wellaria-readonly="true"on the comboboxscale-textarea(--border-color-readonly,--background-readonly), and no hover stylesIt stays in the tab order and always shows the focus outline. That matches a native read-only input and the ARIA combobox pattern, and keeps it different from
disabled. If you'd rather drop it from the tab order, it's a one-line change.Tests: four new spec tests under "when readonly":
aria-readonlyreadonlyis set while openI ran build-pr on my fork. Everything passes with the change, including e2e and visual tests. With only the source change reverted, the new tests fail and nothing else does.
One heads-up: the e2e test "should skip disabled options when typing" failed once on my fork and passed on a rerun with no changes. It types
c,equickly against the 500 ms type-to-select timeout, so it looks timing-sensitive and is unrelated toreadonly.