-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Fix accessibility issues in panels and toolbar buttons #8862
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-8862--material-ui-x.netlify.app/ Updated pagesNo updates. These are the results for the performance tests:
|
packages/grid/x-data-grid/src/models/api/gridPreferencesPanelApi.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid/src/models/api/gridPreferencesPanelApi.ts
Outdated
Show resolved
Hide resolved
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.
Nice improvements accessibility-wise. Thank you 👍
A couple small suggestions:
diff --git a/packages/grid/x-data-grid/src/components/cell/GridActionsCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridActionsCell.tsx
index 5eb94358b..ec2d48da4 100644
--- a/packages/grid/x-data-grid/src/components/cell/GridActionsCell.tsx
+++ b/packages/grid/x-data-grid/src/components/cell/GridActionsCell.tsx
@@ -200,8 +200,8 @@ function GridActionsCell(props: GridActionsCellProps) {
id={buttonId}
aria-label={apiRef.current.getLocaleText('actionsCellMore')}
aria-controls={menuId}
- aria-expanded={open ? 'true' : undefined}
- aria-haspopup="true"
+ aria-expanded={open}
+ aria-haspopup
role="menuitem"
size="small"
onClick={showMenu}
diff --git a/packages/grid/x-data-grid/src/components/columnHeaders/ColumnHeaderMenuIcon.tsx b/packages/grid/x-data-grid/src/components/columnHeaders/ColumnHeaderMenuIcon.tsx
index 1eb387b8e..2d119e398 100644
--- a/packages/grid/x-data-grid/src/components/columnHeaders/ColumnHeaderMenuIcon.tsx
+++ b/packages/grid/x-data-grid/src/components/columnHeaders/ColumnHeaderMenuIcon.tsx
@@ -59,9 +59,9 @@ export const ColumnHeaderMenuIcon = React.memo((props: ColumnHeaderMenuIconProps
aria-label={apiRef.current.getLocaleText('columnMenuLabel')}
size="small"
onClick={handleMenuIconClick}
- aria-expanded={open ? 'true' : undefined}
- aria-haspopup="true"
- aria-controls={columnMenuId}
+ aria-expanded={open}
+ aria-haspopup
+ aria-controls={open ? columnMenuId : undefined}
id={columnMenuButtonId}
{...rootProps.slotProps?.baseIconButton}
>
packages/grid/x-data-grid/src/components/toolbar/GridToolbarFilterButton.tsx
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I've addressed the comments. @MBilalShafi I've added an explicit |
Fixes #5796
Based on #5806
Changes:
aria-controls
to buttons only when the menu / panel is open