-
Notifications
You must be signed in to change notification settings - Fork 861
[EuiDataGrid] Actually fix calls to tabbable instead of moving the issue to a different part of the code #5163
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
Changes from 3 commits
8740397
ebcfbd3
4af1064
5f2b70d
bb63d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,16 +248,16 @@ const IS_JEST_ENVIRONMENT = global.hasOwnProperty('_isJest'); | |
| * and search its ancestors for a div[data-datagrid-cellcontent], if any, | ||
| * which is a valid target for disabling tabbing within | ||
| */ | ||
| function getParentCellContent(_element: Node | HTMLElement) { | ||
| export function getParentCellContent(_element: Node | HTMLElement) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. export for testing |
||
| let element: HTMLElement | null = | ||
| _element.nodeType === document.ELEMENT_NODE | ||
| ? (_element as HTMLElement) | ||
| : _element.parentElement; | ||
|
|
||
| while ( | ||
| element && | ||
| element.nodeName !== 'div' && | ||
| element.hasAttribute('data-datagrid-cellcontent') | ||
| element && // we haven't walked off the document yet | ||
| element.nodeName !== 'div' && // looking for a div | ||
| !element.hasAttribute('data-datagrid-cellcontent') // that has data-datagrid-cellcontent | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦♀️ I feel super bad for not noticing this/digging into it a bit more deeply in the first PR. Apologies! |
||
| ) { | ||
| element = element.parentElement; | ||
| } | ||
|
|
@@ -592,10 +592,16 @@ export const EuiDataGridBody: FunctionComponent<EuiDataGridBodyProps> = ( | |
| }, [unconstrainedHeight, wrapperDimensions, isFullScreen]); | ||
|
|
||
| const preventTabbing = useCallback((records: MutationRecord[]) => { | ||
| // multiple mutation records can implicate the same cell | ||
| // so be sure to only check each cell once | ||
| const processedCells = new Set(); | ||
|
|
||
| for (let i = 0; i < records.length; i++) { | ||
| const record = records[i]; | ||
| // find the cell content owning this mutation | ||
| const cell = getParentCellContent(record.target); | ||
| if (processedCells.has(cell)) continue; | ||
| processedCells.add(cell); | ||
|
|
||
| if (cell) { | ||
| // if we found it, disable tabbable elements | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.