Skip to content

Commit 6447ece

Browse files
authored
[Discover] Don't change selected document when resizing flyout with keyboard (elastic#225447) (elastic#225594)
## Summary Closes elastic#225447 Adds a new rule to not let the event bubble up to the main table so it doesn't change the selected document when the user is resizing the table via keyboard. Before ------ https://github.com/user-attachments/assets/417169fa-f2fc-4a5f-9782-09c84ccdb339 After ------ https://github.com/user-attachments/assets/3794e982-c767-4fda-b432-8ca167f9250d ### 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] 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.
1 parent e3f7586 commit 6447ece

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/platform/plugins/shared/unified_doc_viewer/public/components/doc_viewer_flyout/doc_viewer_flyout.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ export function UnifiedDocViewerFlyout({
158158
return;
159159
}
160160

161+
const isResizableButton =
162+
(ev.target as HTMLElement).getAttribute('data-test-subj') === 'euiResizableButton';
163+
if (isResizableButton) {
164+
// ignore events triggered when the resizable button is focused
165+
return;
166+
}
167+
161168
if (ev.key === keys.ARROW_LEFT || ev.key === keys.ARROW_RIGHT) {
162169
ev.preventDefault();
163170
ev.stopPropagation();

src/platform/test/functional/apps/discover/group9/_doc_viewer.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
518518
await testSubjects.existOrFail(`docViewerFlyoutNavigationPage-1`);
519519
});
520520

521+
it('should not navigate between documents with arrow keys when resizable button is focused', async () => {
522+
await dataGrid.clickRowToggle({ defaultTabId: false });
523+
await discover.isShowingDocViewer();
524+
await testSubjects.existOrFail(`docViewerFlyoutNavigationPage-0`);
525+
await browser.pressKeys(browser.keys.ARROW_RIGHT);
526+
await testSubjects.existOrFail(`docViewerFlyoutNavigationPage-1`);
527+
await testSubjects.click('euiResizableButton');
528+
await browser.pressKeys(browser.keys.ARROW_RIGHT);
529+
await testSubjects.existOrFail(`docViewerFlyoutNavigationPage-1`);
530+
});
531+
521532
it('should close the flyout with the escape key', async () => {
522533
await dataGrid.clickRowToggle({ defaultTabId: false });
523534
expect(await discover.isShowingDocViewer()).to.be(true);

0 commit comments

Comments
 (0)