Skip to content

[Flyout System] require title for session flyouts, support custom actions in top menu#8997

Merged
tsullivan merged 15 commits intoelastic:feat/flyout-systemfrom
tsullivan:session-flyouts/improve-menu-bar
Sep 16, 2025
Merged

[Flyout System] require title for session flyouts, support custom actions in top menu#8997
tsullivan merged 15 commits intoelastic:feat/flyout-systemfrom
tsullivan:session-flyouts/improve-menu-bar

Conversation

@tsullivan
Copy link
Copy Markdown
Member

@tsullivan tsullivan commented Sep 6, 2025

Summary

Part of #8873

Supports rending the top menu bar in EuiFlyout using flyoutMenuProps.

Before

<EuiFlyout
  onClose={closeFlyout}
  size="l"
  id="menu-bar-example-main"
  type="overlay"
  outsideClickCloses={false}
  ownFocus
>
  <EuiFlyoutMenu title="Flyout title">
    {customAction}
  </EuiFlyoutMenu>
  <EuiFlyoutBody>
    <EuiText>
      <p>Simple flyout content.</p>
      <EuiSpacer size="m" />
    </EuiText>
  </EuiFlyoutBody>
</EuiFlyout>

After

Example 1, using title and custom actions from flyoutMenuProps:

<EuiFlyout
  onClose={closeFlyout}
  size="l"
  id="menu-bar-example-main"
  type="overlay"
  outsideClickCloses={false}
  ownFocus
  flyoutMenuProps={{
    title: 'Flyout title',
    customActions,
  }}
>
  <EuiFlyoutBody>
    <EuiText>
      <p>Simple flyout content.</p>
      <EuiSpacer size="m" />
    </EuiText>
  </EuiFlyoutBody>
</EuiFlyout>

Example 2, using title from aria-label prop:

<EuiFlyout
  onClose={closeFlyout}
  size="l"
  id="menu-bar-example-main"
  type="overlay"
  outsideClickCloses={false}
  ownFocus
  aria-label="Flyout title"
  }}
>
  <EuiFlyoutBody>
    <EuiText>
      <p>Simple flyout content.</p>
      <EuiSpacer size="m" />
    </EuiText>
  </EuiFlyoutBody>
</EuiFlyout>

Why are we making this change?

Part of the Epic for Flyout System.

Part of #8873

This PR works on two requirements from the Epic:

  1. Always use top menu bar: flyouts using the session APIs from the Flyout System must always feature a "top menu bar," known as EuiFlyoutMenu. This PR enforces that using validation of EuiFlyout props. The EuiFlyout in a session must have flyoutMenuProps with a title field, or aria-label can be used as the title for the top menu bar.
  2. Support custom actions: consumers will want to add their own icons that launch tools or custom actions in the flyout. This PR exposes a way of doing that, also through the EuiFlyout flyoutMenuProps prop.

Screenshots

flyout_menu_1

Impact to users

Provides consistent flyout menu bar for session-based flyouts.

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@tsullivan tsullivan changed the title [Flyout System] Updte flyout_menu: showCustomActions, showBackButton and historyItems [Flyout System] Update flyout_menu: showCustomActions, showBackButton and historyItems Sep 8, 2025
@tsullivan tsullivan changed the title [Flyout System] Update flyout_menu: showCustomActions, showBackButton and historyItems [Flyout System] flyout_menu: support custom actions Sep 8, 2025
@tsullivan tsullivan changed the title [Flyout System] flyout_menu: support custom actions [Flyout System] require title for session flyouts, support custom actions in top menu Sep 8, 2025
@tsullivan tsullivan force-pushed the session-flyouts/improve-menu-bar branch 2 times, most recently from f42823f to 103540a Compare September 8, 2025 22:16
>
{!isPushed && screenReaderDescription}
{!hideCloseButton && onClose && (
{!flyoutMenuProps && !hideCloseButton && onClose && (
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously, a flyout menu would have to be a child of EuiFlyout, which would cause two close buttons to appear in the DOM. Now, we use the existence of flyoutMenuProps to render the flyout menu within EuiFlyout.

{ config: { mainTitle: 'Third item' } },
];

// TODO: history popover should be internalized in EuiFlyoutMenu when historyItems are passed
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These TODOs will be my next PR

@tsullivan tsullivan force-pushed the session-flyouts/improve-menu-bar branch 2 times, most recently from 965cf1b to 93ad1bf Compare September 8, 2025 22:59
@tsullivan tsullivan force-pushed the session-flyouts/improve-menu-bar branch from 288bed2 to 861da92 Compare September 9, 2025 16:09
@tsullivan tsullivan marked this pull request as ready for review September 9, 2025 16:09
@tsullivan tsullivan requested a review from a team as a code owner September 9, 2025 16:10
@tkajtoch tkajtoch self-requested a review September 10, 2025 14:03
const { flyoutId, level, size } = action;
const { flyoutId, title, level, size } = action;

// Ignore duplicate registrations
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A note for future self: We should probably have a way to debug these in dev mode.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just tested this. If you try to register two sessions with the same ID, we get a console warning, and a dynamic replacement for the duplicate:

warn_once.ts:14 Flyout with ID literalId already registered; using new ID flyout-:re:

Copy link
Copy Markdown
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

Code changes look good to me. I really like the switch to flyoutMenuProps or just aria-label!

I tested updated stories in the PR environment and confirm the changes work as expected.

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@tsullivan tsullivan merged commit 6c9eac3 into elastic:feat/flyout-system Sep 16, 2025
4 checks passed
acstll pushed a commit to acstll/eui that referenced this pull request Sep 17, 2025
…ions in top menu (elastic#8997)

Co-authored-by: Tomasz Kajtoch <tomasz.kajtoch@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants