Skip to content

[ES|QL] LOOKUP JOIN - Keyboard accessibility improvements#229907

Merged
sddonne merged 14 commits intoelastic:feature/lookup-join-uxfrom
sddonne:lookup-join/accesibility-new-branch
Jul 31, 2025
Merged

[ES|QL] LOOKUP JOIN - Keyboard accessibility improvements#229907
sddonne merged 14 commits intoelastic:feature/lookup-join-uxfrom
sddonne:lookup-join/accesibility-new-branch

Conversation

@sddonne
Copy link
Contributor

@sddonne sddonne commented Jul 30, 2025

Part of #207330

⚠️ Note for reviewers: This PR is targeting the feature
branch

Summary

Improves the grid accessibility by:

  • Allowing the user to modify cell values using arrows, enter and scape.
    • The inputs are no longer displayed in the body of the cell, they are now shown as a custom popup.
    • The dataGrid ref has been forwarded so it can be used for UnifiedDataTable, this ref exposes a method to programatically select the focused cell, it's used to keep the focus in the correct place after editing a cell.
    • WithRestorableState HOC now forwards the ref of the component it's wrapping. (Needed as UnifiedDataTable is wrapped with it.)
  • Allow the user to modify columns using keyboard.
    • Unfortunately dataGrid does not expose a way to set focus on column headers, and does not allow to display popups on them. So making them keyboard navegable has been more tricky. It requires to set a data property in the html element that wraps the header and to manually put focus on it when required.
    • We still need a double enter to edit it.
  • Don't move the placeholder columns when filled.
    • Previous implementation was pushing the placeholders at the end of the columns array, now they preserve its place, this is done by treating the placeholders as normal unsaved columns, the user now edits these columns, instead of adding a new one. This requires now to ignore the placeholders columns in some parts of the code.
Screen.Recording.2025-07-30.at.10.20.21.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

...column,
display: <AddColumnHeader initialColumnName={initialColumnName} />,
display: <AddColumnHeader initialColumnName={columnName} containerId={column.id} />,
displayHeaderCellProps: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataGrid exposes the method setFocusedCell for cells, but not way of focusing headers.
The way of achieving this is using a data prop and then select the html element manually.


export type OnCellValueChange = (docId: string, update: any) => void;

export const getValueInputPopover =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input for the cell is no longer in the cell body, now it's displayed as a popup with this method.

}
return acc;
}, [])
take(1),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we set the placeholders as unsaved columns initial value.

onInitialStateChange={onInitialStateChange}
>
<ComponentMemoized {...(props as TProps)} />
{/* @ts-ignore */}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't pass through this type check..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have no other options but using ts-ignore, we should also mentioned the suppressing error. But I wonder if you can make it work with generics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved: 25d95be

@sddonne sddonne requested a review from darnautov July 30, 2025 08:21
@sddonne sddonne marked this pull request as ready for review July 30, 2025 08:24
@sddonne sddonne requested review from a team as code owners July 30, 2025 08:24

export const StringInput: React.FC<ValueInputProps> = ({ onError, ...restOfProps }) => (
<EuiFieldText compressed {...restOfProps} />
export const StringInput = React.forwardRef<HTMLInputElement, ValueInputProps>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you consider using React.forwardRef in getInputComponentForType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took the forwardRefs out, changed the implentation to use a focus trap as you suggested ❤️ 94c9364

onInitialStateChange={onInitialStateChange}
>
<ComponentMemoized {...(props as TProps)} />
{/* @ts-ignore */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have no other options but using ts-ignore, we should also mentioned the suppressing error. But I wonder if you can make it work with generics?

@darnautov
Copy link
Contributor

I understand the intention to fix keyboard accessibility, but with that level of effort, I wonder if it might be better to address the issue on the EUI side instead?

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data Discovery changes LGTM 👍
Nice idea on merging together the restorable state ref and the grid ref methods!

@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [4cde6bc]

History

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sddonne sddonne merged commit f9014f1 into elastic:feature/lookup-join-ux Jul 31, 2025
11 of 12 checks passed
sddonne added a commit that referenced this pull request Aug 4, 2025
Part of #207330

> ⚠️ Built on top of #229907, that
needs to be merged first.
## Summary
* Both for creating an index from scratch as well as editing the
behaviour for adding a new row will be to push a new row in the grid in
the first position. The focus will be changed to the first cell of the
row, and if the user is in a different page than the first one, it will
be directed to the first page.

* For adding a new column, now the "Add field" button will push a new
placeholder column into the grid (in the last position), if the new
column is out of the viewport the grid will be auto scrolled until it's
visible.

* "Add row" button has been renamed as "Add document".

* Added an illustration to the empty state.

<img width="1726" height="874" alt="image"
src="https://github.com/user-attachments/assets/0bbd3476-e4e2-4e16-9060-38f5955d6e0f"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
sddonne added a commit that referenced this pull request Aug 6, 2025
Part of #207330

> ⚠️ Built on top of #229907, that
needs to be merged first.
## Summary
Now when making an edit in a cell or column, the change will be saved if
clicking outside the cell.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants