Skip to content

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

fix elastic#154431

## Summary

This PR addresses the focus order issue in the Saved Objects table.
There are several ways to address this issue:

| Problem | Fix |
|---------|-----|
| Action buttons not immediately focusable after selection |
Programmatically move focus to main action button (e.g., Delete) after
selection |
| Tab order does not match logical order | Ensure toolbar is before
table in DOM, and focus moves as expected |
| Actions are not easily accessible by keyboard | Add keyboard shortcuts
for actions (optional) |
| Screen reader users unaware of state change | Use ARIA live region to
announce selection (optional) |

I’ve taken the **pragmatic** approach and updated the focus management
so that when a user selects an item, focus automatically moves to the
Delete button, making keyboard navigation smoother.

The changes in this PR include:
- Updating the `onSelectionChanged` handler to focus the `Delete` button
after selection, but only if it’s enabled.
- Ensuring the `deleteButtonRef` is properly passed down and forwarded
to the `EuiButton`.
- Using the `setState` callback to guarantee the UI is updated before
moving focus.

With these changes, users can select items and immediately interact with
the Delete or Export buttons without having to tab through the entire
table. This should make the table more accessible and efficient to use.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [x] Changing the focus order from navigating through the saved objects
table list directly to the delete button carries a risk that users might
accidentally trigger deleting a saved object by mistake. The risk is low
because the delete action has to be confirmed in a pop up modal before
it triggers.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 731e97f)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Jul 31, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) July 31, 2025 11:31
@kibanamachine kibanamachine merged commit c917565 into elastic:9.1 Jul 31, 2025
16 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
savedObjectsManagement 82.3KB 82.9KB +565.0B

cc @TinaHeiligers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants