Repository navigation
[BUGFIX] TimeRangeSelector: name the combobox after the shown time range - #406
Merged
Gladorme merged 1 commit intoOct 28, 2026
Merged
Conversation
The combobox's aria-label interpolated the TimeRangeValue object, so screen readers announced "Select time range. Currently set to [object Object]". Compute the text the selector shows once (the matching time option's display, else the formatted range) and use it for both the rendered value and the label. Signed-off-by: Juntao Wang <juntwang@redhat.com>
Gladorme
approved these changes
Oct 28, 2026
Member
|
lgtm, thanks :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The problem
TimeRangeSelectorsets its combobox's accessible name with:valueis theTimeRangeValueprop, an object ({ pastDuration: '1h' }or{ start, end }), so the template literal turns it into[object Object]. Screen readers announce:The label has been like this since
TimeRangeSelectormoved to this repository (7aa6679). It's inv0.54.0,v0.55.0andmain.The fix
The component already computes the text it shows: the matching time option's
display(for example "Last 1 hour"), or elseformatTimeRange(value, timeZone)for a range that isn't a preset. This PR computes that string once, asdisplayValue, and uses it for both the rendered value and thearia-label. The visible text doesn't change.Select time range. Currently set to [object Object]Select time range. Currently set to Last 1 hourSelect time range. Currently set to [object Object]Select time range. Currently set to 2026-03-09 09:00:00 - 2026-03-09 10:00:00Tests
TimeRangeSelector.test.tsxis new. It renders the selector with a relative range that matches a preset and with an absolute range, and looks up the combobox by role and accessible name. Both tests fail onmain. The failure reports the combobox's name asSelect time range. Currently set to [object Object]. Both pass with the fix.Related: perses/perses#4329 (general accessibility work, which doesn't cover this label).
Screenshots
No visual change: the selector shows the same text as before. Only the accessible name changes.
I also checked it in a real app. That app renders Perses dashboards with
TimeRangeControlsfrom@perses-dev/plugin-system0.54.0. I applied the same change to the installed@perses-dev/components0.54.0 and read the browser's accessibility tree with Playwright:combobox "Select time range. Currently set to [object Object]", showing "Last 1 hour"combobox "Select time range. Currently set to Last 1 hour"combobox "Select time range. Currently set to Last 6 hours"start/end: the name ends with the same formatted range the selector showsChecklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
Validation
Node 24.19.0 (from
.nvmrc) and npm 11.17.0, afternpm ci:npm run lint,npm run format:check,npm run type-check,npm run test,npm run buildandmake checklicenseat the repository root: all pass.componentslint: 67 warnings before and after. The two inTimeRangeSelector.tsx(no-shadowon the date picker'svalueparameter,no-array-index-key) were already there.plugin-systemtests forTimeRangeControls, which find this combobox by/time range/i, still pass.AI assistance
Claude Code was used to find the issue, make the change and the test, run the checks and write this description. I reviewed the change and the results.
🤖 Generated with Claude Code