Skip to content

[Discover] Fix app menu focus when closing background search flyout#250332

Merged
davismcphee merged 1 commit intoelastic:mainfrom
davismcphee:discover-fix-background-search-focus
Jan 26, 2026
Merged

[Discover] Fix app menu focus when closing background search flyout#250332
davismcphee merged 1 commit intoelastic:mainfrom
davismcphee:discover-fix-background-search-focus

Conversation

@davismcphee
Copy link
Copy Markdown
Contributor

Summary

Noticed while testing #246156. It looks like closing the background search flyout in Discover doesn't return focus to the correct app menu button. This PR fixes that.

It also fixes an issue where EuiFlyout was rendered twice for the background search flyout (caused by passing another EuiFlyout into coreStart.overlays.openFlyout). Afaict this didn't actually affect any functionality other than displaying a duplicate flyout backdrop overlay, but made the onClose callback misbehave, so I fixed it.

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@davismcphee davismcphee self-assigned this Jan 26, 2026
@davismcphee davismcphee added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Feature:BackgroundSearch Background search feature used in Discover, Dashboard, etc. labels Jan 26, 2026
@davismcphee davismcphee marked this pull request as ready for review January 26, 2026 03:43
@davismcphee davismcphee requested review from a team as code owners January 26, 2026 03:43
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Comment on lines 88 to -95

describe('when the header close button is clicked', () => {
it('calls the onClose callback', async () => {
const { onClose, user } = setup();
const closeButton = screen.getByLabelText('Close this dialog');
await user.click(closeButton);
expect(onClose).toHaveBeenCalled();
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should be able to keep this test if we still have the close button on the top right

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The top right close button is now handled through coreStart.overlays.openFlyout and doesn't appear when rendering Flyout directly, so I wasn't sure how to preserve this test. I'm going to merge this PR to get the fix in, but I can open a follow up to restore this test if you have suggestions how.

Copy link
Copy Markdown
Contributor

@AlexGPlay AlexGPlay left a comment

Choose a reason for hiding this comment

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

other than the removed test lgtm - thank you for fixing it 🙇🏻

Copy link
Copy Markdown
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.

LGTM, thanks! 👍

@davismcphee davismcphee merged commit 691d919 into elastic:main Jan 26, 2026
31 checks passed
@davismcphee davismcphee deleted the discover-fix-background-search-focus branch January 26, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:BackgroundSearch Background search feature used in Discover, Dashboard, etc. Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants