Skip to content

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Sep 9, 2025

Summary

Depends on #8997
Resolves #8873

This exposes tracked history to flyout sessions in contexts and exposes controls in the UI to allow users to navigate to previous flyouts.

When a user opens a flyout for the first time:

  1. The onActive callback (optional prop) is fired.

When the user navigates to a previous flyout:

  1. The "newer" flyout sessions are discarded from the tracked history state and their onClose callbacks are fired
  2. The onActive callback for the flyout that becomes active is fired

Note: This PR is targeted to the feat/flyout-system feature branch.

Why are we making this change?

A requirement for the Flyout System is to allow users to navigate to previous flyout sessions. This PR achieves that, and allows consumer apps to have a local state that is synchronized with the internal state of the Flyout System.

Screenshots

A new "Multi-session example" storybook has been added to show the effects of the lifecycle callbacks being called:

Flyout History Tracking Demo

Impact to users

Ability to view a list of previous flyout sessions in state, and navigate to those flyout sessions.

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 force-pushed the session-flyouts/track-history branch 2 times, most recently from 1dac84e to 3331dce Compare September 11, 2025 16:10
@tsullivan tsullivan changed the base branch from main to feat/flyout-system September 11, 2025 16:24
@tsullivan
Copy link
Member Author

This is a code smell.

@clintandrewhall I removed the problematic setTimeout call by removing the callback_manager.ts file entirely. There is now a simpler, synchronous approach for calling the onClose callbacks and removing the flyout from state. I think the current state is a much better approach because it allows the reducer to just be responsible for updating state, rather than having it also call callbacks.

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

A few nits, but looks good to me. Approving to unblock.

Great work!

@acstll acstll self-requested a review September 26, 2025 07:57
Copy link
Contributor

@acstll acstll left a comment

Choose a reason for hiding this comment

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

Only a suggestion for the changelog, and translations in EuiFlyoutMenu. I tested the feature locally and it's working as expected.

Comment on lines 57 to 59
<EuiButtonEmpty size="xs" color="text" {...props}>
<EuiIcon type="editorUndo" /> Back
</EuiButtonEmpty>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if you'd like to add translations now, but here's a suggestion (you'd need to adjust imports) — also, the icon can be part of EuiButtonEmpty

Suggested change
<EuiButtonEmpty size="xs" color="text" {...props}>
<EuiIcon type="editorUndo" /> Back
</EuiButtonEmpty>
<EuiButtonEmpty size="xs" color="text" iconType="editorUndo" {...props}>
<EuiI18n token="euiFlyoutMenu.back" default="Back" />
</EuiButtonEmpty>

return (
<EuiPopover
button={
<EuiButtonIcon iconType="arrowDown" color="text" aria-label="History" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<EuiButtonIcon iconType="arrowDown" color="text" aria-label="History" />
<EuiButtonIcon iconType="arrowDown" color="text" aria-label={useEuiI18n('euiFlyoutMenu.history', 'History')} />

@@ -0,0 +1 @@
[Flyout System] Added back button, history stack managed history controls. Added history navigation events.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would more alined with how changelogs are written in EUI, but feel free to take it or not. I think the important bit is having at least 1 bullet point and start with either "Added" or "Updated", while also mentioning the public-facing component affected:

Suggested change
[Flyout System] Added back button, history stack managed history controls. Added history navigation events.
- Updated `EuiFlyout` with new `onActive` callback and enable stack managed history controls.
- Updated `EuiFlyoutMenu` with new prop `historyItems` and refactored props for back button.

@tsullivan tsullivan force-pushed the session-flyouts/track-history branch from 7101792 to 6cb11fb Compare September 26, 2025 21:30
@tsullivan tsullivan requested a review from acstll September 29, 2025 17:43
@tsullivan
Copy link
Member Author

@acstll This is ready for another look!

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link
Contributor

@acstll acstll left a comment

Choose a reason for hiding this comment

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

🟢 Looks good to merge! Thanks for the updates @tsullivan

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@tsullivan tsullivan merged commit faf365c into elastic:feat/flyout-system Sep 29, 2025
4 checks passed
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.

EuiFlyout Add menu bar support history, custom actions and links
5 participants