Repository navigation
Fix: improve accessibility for icon buttons (Table Editor menu) - #47639
Conversation
This reverts commit 94714f6.
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@ChloeGarciaMillerand is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughIcon-only action buttons in four Studio components now use Tooltip wrappers and explicit aria-labels for add-column, more-options, and new-table actions. ChangesTooltip additions for icon-only buttons
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx (1)
335-347: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winaria-label hardcodes "table" for entities that may be views/foreign tables.
aria-label={More options for ${table.name} table}is applied regardless of entity kind, but this same trigger renders for tables, views, materialized views, and foreign tables (isTable/isView/isMaterializedView/isForeignTableare all checked in this component). Screen reader users will hear "table" even when acting on a view or foreign table.♻️ Proposed fix
- <Button - variant="default" - icon={<MoreVertical />} - className="h-7 w-7" - aria-label={`More options for ${table.name} table`} - /> + <Button + variant="default" + icon={<MoreVertical />} + className="h-7 w-7" + aria-label={`More options for ${table.name}`} + />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx` around lines 335 - 347, The aria-label on the MoreVertical button in GridHeaderActions should not always say “table” because this trigger is used for tables, views, materialized views, and foreign tables. Update the label generation in this component to use the actual entity kind already available via the isTable/isView/isMaterializedView/isForeignTable checks, so the DropdownMenuTrigger/Button announces the correct type for screen readers.apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx (1)
236-252: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winaria-label says "table actions" even for views/materialized views.
aria-label={${entity.name} table actions}is wrong for non-table entities —entity.typecan beENTITY_TYPE.VIEWorENTITY_TYPE.MATERIALIZED_VIEWper the branches further down (Lines 303-304, 435, 483). The component already has aformatTooltipText(entity.type)helper (Line 151) that converts type to readable text — reuse it instead of hardcoding "table".♻️ Proposed fix
- <Button - variant="text" - className="w-6 h-6" - icon={<MoreVertical size={14} strokeWidth={2} />} - onClick={(e) => e.preventDefault()} - aria-label={`${entity.name} table actions`} - /> + <Button + variant="text" + className="w-6 h-6" + icon={<MoreVertical size={14} strokeWidth={2} />} + onClick={(e) => e.preventDefault()} + aria-label={`${entity.name} actions`} + />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx` around lines 236 - 252, The aria-label on the DropdownMenuTrigger/Button is hardcoded to “table actions,” which is incorrect for non-table entities. Update the EntityListItem component to reuse the existing formatTooltipText(entity.type) helper when building the aria-label so it reflects the actual entity type for tables, views, and materialized views. Locate the trigger/button markup in EntityListItem and replace the hardcoded “table” wording with the formatted type text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx`:
- Around line 335-347: The aria-label on the MoreVertical button in
GridHeaderActions should not always say “table” because this trigger is used for
tables, views, materialized views, and foreign tables. Update the label
generation in this component to use the actual entity kind already available via
the isTable/isView/isMaterializedView/isForeignTable checks, so the
DropdownMenuTrigger/Button announces the correct type for screen readers.
In `@apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx`:
- Around line 236-252: The aria-label on the DropdownMenuTrigger/Button is
hardcoded to “table actions,” which is incorrect for non-table entities. Update
the EntityListItem component to reuse the existing
formatTooltipText(entity.type) helper when building the aria-label so it
reflects the actual entity type for tables, views, and materialized views.
Locate the trigger/button markup in EntityListItem and replace the hardcoded
“table” wording with the formatted type text.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c3cc74fa-13e7-4eec-8ac3-c4e86d4779e7
📒 Files selected for processing (4)
apps/studio/components/grid/components/grid/AddColumn.tsxapps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsxapps/studio/components/layouts/TableEditorLayout/EntityListItem.tsxapps/studio/components/layouts/Tabs/Tabs.tsx
|
The two comments from code rabbit are good. Can you check? |
|
I have made the changes requested by coderabbit; however, in EntityListItem, I had to create a variable called Do we validate it like this, or would |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx (1)
90-97: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a lookup map instead of nested ternary for readability.
The nested ternary works but is harder to scan at a glance. A lookup object keyed by entity type would be more maintainable if new entity kinds are added later.
♻️ Optional refactor
+const ENTITY_KIND_LABEL: Record<string, string> = { + [ENTITY_TYPE.TABLE]: 'table', + [ENTITY_TYPE.FOREIGN_TABLE]: 'foreign table', + [ENTITY_TYPE.VIEW]: 'view', + [ENTITY_TYPE.MATERIALIZED_VIEW]: 'materialized view', +} + const entityKind = - isTable - ? 'table' - : isForeignTable - ? 'foreign table' - : isView - ? 'view' - : 'materialized view' + ENTITY_KIND_LABEL[table.entity_type] ?? 'materialized view'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx` around lines 90 - 97, The entityKind selection in GridHeaderActions is using a nested ternary, which is hard to read and extend. Replace it with a clearer lookup-based approach or equivalent mapping logic inside the same component, using the existing isTable, isForeignTable, isView, and materialized view cases to derive entityKind. Keep the behavior unchanged while making it easier to add new entity kinds later.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx`:
- Around line 90-97: The entityKind selection in GridHeaderActions is using a
nested ternary, which is hard to read and extend. Replace it with a clearer
lookup-based approach or equivalent mapping logic inside the same component,
using the existing isTable, isForeignTable, isView, and materialized view cases
to derive entityKind. Keep the behavior unchanged while making it easier to add
new entity kinds later.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e0e3c570-1024-45d1-89dc-be2eebe7701c
📒 Files selected for processing (2)
apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsxapps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx
| className="w-6 h-6" | ||
| icon={<MoreVertical size={14} strokeWidth={2} />} | ||
| onClick={(e) => e.preventDefault()} | ||
| aria-label={`${entity.name} ${entityKind} actions`} |
There was a problem hiding this comment.
Let's just drop the entityKind here. It's probably confusing for most users
There was a problem hiding this comment.
After discussion, 'actions' is not true in every case. Sometimes, 'settings' or 'options' is more appropriate. This component should take something like an 'aria-label' text field instead and can be handled case-by-case.
| variant="default" | ||
| icon={<MoreVertical />} | ||
| className="h-7 w-7" | ||
| aria-label={`More options for ${table.name} ${entityKind}`} |
There was a problem hiding this comment.
Same here, can you drop the entityKind?
| const isView = isTableLikeView(table) | ||
| const isMaterializedView = isTableLikeMaterializedView(table) | ||
|
|
||
| const entityKind = isTable |
There was a problem hiding this comment.
Could drop this and simplify this by instead exposing the option to add an aria-label for every context.
| className="w-6 h-6" | ||
| icon={<MoreVertical size={14} strokeWidth={2} />} | ||
| onClick={(e) => e.preventDefault()} | ||
| aria-label={`${entity.name} ${entityKind} actions`} |
There was a problem hiding this comment.
After discussion, 'actions' is not true in every case. Sometimes, 'settings' or 'options' is more appropriate. This component should take something like an 'aria-label' text field instead and can be handled case-by-case.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx (1)
247-247: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMake the
aria-labelconsistent with the tooltip text.The tooltip content here is "More options", and in
GridHeaderActions.tsx, thearia-labelwas updated to"More options for ${table.name}". For consistency across the UI and to match the tooltip content, consider using"More options for ${entity.name}"instead of"actions". This also aligns with previous review feedback discussing that 'actions' is not universally true in every case.♻️ Proposed fix
- aria-label={`${entity.name} actions`} + aria-label={`More options for ${entity.name}`}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx` at line 247, Update the aria-label on the entity actions control in EntityListItem to use the consistent “More options for ${entity.name}” wording, matching the tooltip and GridHeaderActions behavior; leave the surrounding action handling unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx`:
- Line 247: Update the aria-label on the entity actions control in
EntityListItem to use the consistent “More options for ${entity.name}” wording,
matching the tooltip and GridHeaderActions behavior; leave the surrounding
action handling unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 510c8a2e-8d09-4c60-acc3-bd47eba322d3
📒 Files selected for processing (2)
apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsxapps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx
Braintrust eval report
|
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix (accessibility improvement)
What is the current behavior?
Icon-only buttons do not have explicit accessible names for screen readers or tooltips.
What is the new behavior?
All icon-only buttons now have explicit accessible names using visually hidden text (sr-only), ensuring proper screen reader support.
Additional context
Tooltip text is preserved or added for visual users.
No visual changes were introduced.
Summary by CodeRabbit
aria-labels (e.g., “Add new column”, “More options for …”, “New table”).