-
Notifications
You must be signed in to change notification settings - Fork 16.6k
fix(ListView): add tooltip for layout toggle buttons #37581
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
base: master
Are you sure you want to change the base?
Conversation
Code Review Agent Run #e23152Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
| onClick={e => { | ||
| e.currentTarget.blur(); | ||
| setMode('card'); | ||
| }} | ||
| className={cx('toggle-button', { active: mode === 'card' })} | ||
| > | ||
| <Icons.AppstoreOutlined iconSize="xl" /> | ||
| </div> | ||
| </Tooltip> | ||
| <Tooltip title={t('List view')}> | ||
| <div | ||
| role="button" | ||
| tabIndex={0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Toggle buttons do not expose their pressed state to assistive technologies: the divs use role="button" and visually indicate active state via className, but they lack an aria-pressed attribute. Add aria-pressed tied to the active condition so screen readers can expose the toggle state. [possible bug]
Severity Level: Major ⚠️
- ❌ Screen readers don't announce toggle state.
- ⚠️ Affects ListView view-mode toggles accessibility.| onClick={e => { | |
| e.currentTarget.blur(); | |
| setMode('card'); | |
| }} | |
| className={cx('toggle-button', { active: mode === 'card' })} | |
| > | |
| <Icons.AppstoreOutlined iconSize="xl" /> | |
| </div> | |
| </Tooltip> | |
| <Tooltip title={t('List view')}> | |
| <div | |
| role="button" | |
| tabIndex={0} | |
| aria-pressed={mode === 'card'} | |
| onClick={e => { | |
| e.currentTarget.blur(); | |
| setMode('card'); | |
| }} | |
| className={cx('toggle-button', { active: mode === 'card' })} | |
| > | |
| <Icons.AppstoreOutlined iconSize="xl" /> | |
| </div> | |
| </Tooltip> | |
| <Tooltip title={t('List view')}> | |
| <div | |
| role="button" | |
| tabIndex={0} | |
| aria-pressed={mode === 'table'} |
Steps of Reproduction ✅
1. Run the app and load a page that shows the ListView view-mode toggle (ListView
component).
2. Open an accessibility inspector or screen reader (e.g., VoiceOver/NVDA) and navigate to
the toggle.
3. Inspect the toggle element at ListView.tsx:205-230: it has role="button" and visual
active class,
but no aria-pressed attribute is present to convey state to assistive tech.
4. Observe assistive tech does not announce the pressed/toggled state; adding aria-pressed
(aria-pressed={mode === 'card' / mode === 'table'}) exposes state to screen readers.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/components/ListView/ListView.tsx
**Line:** 209:221
**Comment:**
*Possible Bug: Toggle buttons do not expose their pressed state to assistive technologies: the divs use role="button" and visually indicate active state via className, but they lack an `aria-pressed` attribute. Add `aria-pressed` tied to the active condition so screen readers can expose the toggle state.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following: pip3 install -r requirements/development.txt Alternatively it is possible to run pre-commit by running pre-commit manually: pre-commit run --all-files |
Thanks for pointing that out! I have pre-commit installed locally and ran it manually. pre-commit run --files superset-frontend/src/components/ListView/ListView.tsx Please let me know if you’d prefer that I run the full pre-commit run --all-files checks as well. |
|
@sfirke thanks for the guidance earlier! I’ve opened a new PR rebased on the latest I verified locally that:
Running Please let me know if you’d like me to adjust anything further. |
|
I see that pre-commit is failing with this: ❌ Pre-commit check failed (exit code: 1). I hear you that it is modifying files it shouldn't. So instead of running it with a flag to touch all files, can you modify the command to touch only that file? Or run it on all files and only keep the changes to this one, reverting the other changes? Because it seems like there is some white space or formatting issue with this one file you modified. And we can't merge it until it passes GitHub's CI checks. |
|
@sfirke thanks for the clarification! I ran pre-commit scoped only to the modified file as suggested: pre-commit run --files superset-frontend/src/components/ListView/ListView.tsx All hooks pass locally, and there are no remaining diffs: git status → clean git diff → empty This suggests the formatting/whitespace issues in ListView.tsx should be resolved, and no other files are being modified anymore. I’ve attached a screenshot showing the command + results. |
|
@sfirke I ran pre-commit run --files superset-frontend/src/components/ListView/ListView.tsx locally and all hooks pass, and I currently have a clean working tree with no diff. It looks like CI still believes this file would be modified. I suspect a line-ending or environment mismatch and am re-running with a clean checkout to align with CI. I’ll push an update shortly. |
|
Yep this is a tricky situation. My best bet is that the rules on your local pre-commit check don't match what is running on the GitHub CI? |
|
@sfirke I also verified git diff is empty after running it, so the file itself appears formatted correctly on my side. I pushed an empty commit to retrigger CI in case it was stale. If CI still fails, would you prefer I align my environment (e.g. specific Node / Python / pre-commit versions), or is there a recommended way to reproduce the exact CI hook locally? |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I'm re-running the check now. But if you didn't change anything it will fail again. Maybe re-clone the repo fresh and apply your change and try it there? I don't know how else to resolve it. Keep trying things with AI until your local pre-commit modifies that file? Until that happens the GitHub check will fail. We're reaching the limits of my assistance. |
|
@sfirke @SBIN2010 • pre-commit run --files superset-frontend/src/components/ListView/ListView.tsx passes The CI diff appears to be a formatter-only change (likely line endings / whitespace / tool version mismatch), but I’m unable to reproduce it locally even after rerunning the exact hooks. If you’re okay with it, I’m happy to: Just let me know what you’d prefer — happy to follow your guidance. |
|
@sfirke sir now, is it mergeable now? |
|
It's passing CI! I don't know JavaScript/ TypeScript so another committer should review and merge. But your work is set here for now. |
Code Review Agent Run #db4a25Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |


Summary
Adds tooltips to the ListView layout toggle buttons to improve discoverability and accessibility.
This PR supersedes #37304
Note: Frontend type-check passes locally via pre-commit on the modified file.
The pre-commit meta-check in CI reports a skipped hook due to environment setup.
before adding the tooltip. (when i hover over it)

after adding the tooltips.(when i hover over it)




TESTING INSTRUCTIONS
ADDITIONAL INFORMATION