-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[DataGridPro] Fix Tree Data and Row Grouping rows accessibility #13623
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
Merged
arminmeh
merged 94 commits into
mui:master
from
arminmeh:expandable-rows-not-accessible
Aug 13, 2024
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
d1ceefd
Add visible row ids to parent id lookup selector
arminmeh 895c71e
Extend grid row for the pro grid to include additional aria atteribut…
arminmeh 5b7aa0b
aria-rowcount is updated when filter is applied
arminmeh 3cac35a
Extract pro grid row into a separate component to use conditional ren…
arminmeh b0c2ff9
Update API docs
arminmeh ce93f09
Add tests
arminmeh 3ddce45
Generate tree grid aria attributes via hook
arminmeh 8f8b45b
Remove slow selector and filter out current level ids in the callback
arminmeh 38c7cf3
Remove unused import and rebuild API docs
arminmeh b49a771
Expand test with the assertion that checks reset of the position counter
arminmeh 9587f1e
Add lookup selector for position in set (branch) of the tree
arminmeh f6e08fa
Use pipe processor to adjust aria attributes for better performance. …
arminmeh d5cced0
Fix lint issues
arminmeh d5774f2
Update API docs
arminmeh 8abb528
Fix counter reset logic
arminmeh 2b8b493
Fix top level set size count
arminmeh 4289b1d
Remove grid row attributes pipe processor
arminmeh 83f833b
Add grid configuration context and models
arminmeh 52f6d75
Create community and pro version of the hooks that compile row specif…
arminmeh 0cb9b81
Add hooks to the configuration context
arminmeh 9cc9f07
Use configuration context to add aria attributes to the grid row
arminmeh 0380e54
Fix lint issue
arminmeh a55ad86
Ignore multiple export lint issue for re-exporting of the aria attrib…
arminmeh 82c7d7b
Add additional assertions to the tree data accessbility test to cover…
arminmeh 1ea6d0b
Add children count lookup
arminmeh 2aa1850
Add children count lookup selector
arminmeh e0f8830
Use children count lookup to determine the set size (excludes grand c…
arminmeh c4677b7
Add tests for the new count lookup
arminmeh 2f4cb25
Fix lint issues
arminmeh 323d3eb
Rebuild API docs
arminmeh 65fa808
Remove ariaAttributes from pipe processing interface
arminmeh 841f0e0
Extract static object to prevent unnecessary re-renders
arminmeh 1c881b4
Rename useGridConfigurationContext -> useGridConfiguration
arminmeh 0d0090d
Rename gridConfiguration -> configuration
arminmeh 226ac3f
Do not wrap aria attributes getter into an object
arminmeh bc80a39
Add new prop to the return value of the skip filtering utility
arminmeh 49ae70f
Change hasServerChildren to serverChildrenCount to be able to re-use …
arminmeh 2bbfa54
Fix build
arminmeh c44f000
group row should not be made if serverChildrenCount is undefined
arminmeh 6289ff2
Expand the filteredChildrenCountLookup description
arminmeh 943ddce
treegird role is set if row grouping is in place
arminmeh 752d575
Add additional aria attributes to the rows in a grid that has row gro…
arminmeh 8a3fe59
Add accessibility test to the row grouping feature
arminmeh 587ec30
Util cleanup
arminmeh aaf0f2e
Pass row node instead of id to the aria attributes hook
arminmeh 6aae705
Fallback to 0 if node does not have serverChildrenCount
arminmeh 3c9c0ae
Fix server row count models and update their descriptions
arminmeh 8351828
Extend tests
arminmeh b38642f
Update filter state model description for the child count
arminmeh c80b879
Update selector name to better reflect its purpose. Make it private a…
arminmeh 53f342c
Use sanitized grouping model selector
arminmeh 5f348d2
Use grid configuration to apply different values to the grid aria att…
arminmeh 1ddc129
Update serverChildrenCount description
arminmeh a79c418
Group internal exports that need lint rule disabled
arminmeh ea42fe2
debug: list installed dependencies
cherniavskii f91871c
try removing everything from .next except cache folder
cherniavskii f254de6
do not error on directories
cherniavskii f887561
fix exit code 2
cherniavskii 43374fe
fork netlify plugin
cherniavskii 33a5376
try removing docs/.next before build
cherniavskii ba96136
make sure the next folder does not exist before build
cherniavskii aeca849
Code cleanup
arminmeh 008cd4e
isRowSelectable returns false if the whole feature is disabled
arminmeh 41837e5
Fix docs referring to a cell for a row API
arminmeh a6cc046
Selectable row always has 'aria-selected' attribute
arminmeh ac70073
pinned and footer rows should not get the set specific aria attributes
arminmeh 2a51b10
Add missing dependencies
arminmeh 9e546d8
log @mui/joy/package.json
cherniavskii 73b64a7
fix import order
cherniavskii 0a72fd5
log @mui/joy/package.json
cherniavskii 6c45d83
add InitColorSchemeScript import
cherniavskii b5965ee
Delete from the docs script
arminmeh cbaa807
try importing InitColorSchemeScript from MUI X _document
cherniavskii 2f089d5
Merge branch 'expandable-rows-not-accessible' of https://github.com/a…
cherniavskii 56f5131
duplicate _document from monorepo
cherniavskii 985cc2a
revert _document
cherniavskii 38a3195
revert netlify config changes
cherniavskii 36ee004
remove netlify plugin fork
cherniavskii 7d53c83
Merge branch 'master' into expandable-rows-not-accessible
cherniavskii 0ec4fa5
No need to return an object
arminmeh e5bf5ea
Add experimental flag for the aria attribute change in the premium da…
arminmeh 106cc31
upgrade @tanstack/query-core
cherniavskii f440e68
Make selector internal
arminmeh f06d32b
Make children count selector internal
arminmeh 7135b28
Merge branch 'master' into expandable-rows-not-accessible
arminmeh 23ed256
Merge branch 'master' into expandable-rows-not-accessible
cherniavskii d3aff14
downgrade pnpm
cherniavskii dff8750
downgrade pnpm (again)
cherniavskii d9d4107
reset pnpm version
cherniavskii 8069753
Add documentation section for the experimental flag
arminmeh c70e68e
Align names
arminmeh aa892fe
remove --shamefully-hoist flag
cherniavskii 84ef55f
Merge branch 'master' into expandable-rows-not-accessible
cherniavskii 4f48e06
revert dependency upgrade
cherniavskii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| DataGridPremium, | ||
| useGridApiRef, | ||
| useKeepGroupedColumnsHidden, | ||
| } from '@mui/x-data-grid-premium'; | ||
| import { useMovieData } from '@mui/x-data-grid-generator'; | ||
|
|
||
| export default function RowGroupingAriaV8() { | ||
| const data = useMovieData(); | ||
| const apiRef = useGridApiRef(); | ||
|
|
||
| const initialState = useKeepGroupedColumnsHidden({ | ||
| apiRef, | ||
| initialState: { | ||
| rowGrouping: { | ||
| model: ['company'], | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| return ( | ||
| <div style={{ height: 400, width: '100%' }}> | ||
| <DataGridPremium | ||
| {...data} | ||
| apiRef={apiRef} | ||
| initialState={initialState} | ||
| experimentalFeatures={{ ariaV8: true }} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| DataGridPremium, | ||
| useGridApiRef, | ||
| useKeepGroupedColumnsHidden, | ||
| } from '@mui/x-data-grid-premium'; | ||
| import { useMovieData } from '@mui/x-data-grid-generator'; | ||
|
|
||
| export default function RowGroupingAriaV8() { | ||
| const data = useMovieData(); | ||
| const apiRef = useGridApiRef(); | ||
|
|
||
| const initialState = useKeepGroupedColumnsHidden({ | ||
| apiRef, | ||
| initialState: { | ||
| rowGrouping: { | ||
| model: ['company'], | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| return ( | ||
| <div style={{ height: 400, width: '100%' }}> | ||
| <DataGridPremium | ||
| {...data} | ||
| apiRef={apiRef} | ||
| initialState={initialState} | ||
| experimentalFeatures={{ ariaV8: true }} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
6 changes: 6 additions & 0 deletions
6
docs/data/data-grid/row-grouping/RowGroupingAriaV8.tsx.preview
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <DataGridPremium | ||
| {...data} | ||
| apiRef={apiRef} | ||
| initialState={initialState} | ||
| experimentalFeatures={{ ariaV8: true }} | ||
| /> |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,5 @@ | |
| groupingColDef={{ | ||
| leafField: 'traderEmail', | ||
| }} | ||
| experimentalFeatures={{ ariaV8: true }} | ||
| /> | ||
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './useGridRowAriaAttributes'; |
12 changes: 12 additions & 0 deletions
12
packages/x-data-grid-premium/src/hooks/features/rows/useGridRowAriaAttributes.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { | ||
| useGridRowAriaAttributes as useGridRowAriaAttributesPro, | ||
| useGridSelector, | ||
| } from '@mui/x-data-grid-pro/internals'; | ||
| import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext'; | ||
| import { gridRowGroupingSanitizedModelSelector } from '../rowGrouping/gridRowGroupingSelector'; | ||
|
|
||
| export const useGridRowAriaAttributes = () => { | ||
| const apiRef = useGridPrivateApiContext(); | ||
| const gridRowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector); | ||
| return useGridRowAriaAttributesPro(gridRowGroupingModel.length > 0); | ||
| }; |
25 changes: 25 additions & 0 deletions
25
packages/x-data-grid-premium/src/hooks/utils/useGridAriaAttributes.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| useGridAriaAttributes as useGridAriaAttributesPro, | ||
| useGridSelector, | ||
| } from '@mui/x-data-grid-pro/internals'; | ||
| import { gridRowGroupingSanitizedModelSelector } from '../features/rowGrouping/gridRowGroupingSelector'; | ||
| import { useGridPrivateApiContext } from './useGridPrivateApiContext'; | ||
| import { useGridRootProps } from './useGridRootProps'; | ||
|
|
||
| export const useGridAriaAttributes = (): React.HTMLAttributes<HTMLElement> => { | ||
| const rootProps = useGridRootProps(); | ||
| const ariaAttributesPro = useGridAriaAttributesPro(); | ||
| const apiRef = useGridPrivateApiContext(); | ||
| const gridRowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector); | ||
|
|
||
| const ariaAttributesPremium = | ||
| rootProps.experimentalFeatures?.ariaV8 && gridRowGroupingModel.length > 0 | ||
| ? { role: 'treegrid' } | ||
| : {}; | ||
|
|
||
| return { | ||
| ...ariaAttributesPro, | ||
| ...ariaAttributesPremium, | ||
| }; | ||
| }; |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.