[Flyout System] Support width offset using --euiFlyoutOffsetInlineEnd#9344
Closed
tsullivan wants to merge 14 commits intoelastic:mainfrom
Closed
[Flyout System] Support width offset using --euiFlyoutOffsetInlineEnd#9344tsullivan wants to merge 14 commits intoelastic:mainfrom
--euiFlyoutOffsetInlineEnd#9344tsullivan wants to merge 14 commits intoelastic:mainfrom
Conversation
Problem Analysis: The layout mode was not transitioning from stacked to side-by-side when viewport increased. Root cause was a circular dependency in the width calculation logic: 1. Measured widths (parentWidth, childWidth) were used first for layout decisions 2. These measured widths come from actual DOM rendering 3. In stacked mode, flyouts render at different widths than side-by-side 4. Using those stacked-mode widths to decide if we should switch modes kept the layout stuck in stacked mode Solution: Prioritize calculated widths from size configuration over measured widths: - Calculate widths using getWidthFromSize(size, windowWidth) first - These are deterministic and independent of current layout mode - Only fall back to measured widths if size is unavailable - Use windowWidth (not effectiveViewportWidth) to match CSS vw units - Use effectiveViewportWidth only for fit percentage calculation Hysteresis Decision: Initially considered reintroducing hysteresis (85%/95% thresholds) to prevent flickering, but with 300px sidebar offset this creates a 1125px gap between transitions (unacceptably large). With single 90% threshold, the gap is minimal (~20px) in both scenarios, providing responsive and predictable behavior. Testing: - Without offset: transitions at 800-820px (20px gap) - With 300px offset: transitions at 1780-1800px (20px gap) - Layout correctly switches in both directions
Collaborator
💚 Build Succeeded |
Collaborator
💔 Build Failed
Failed CI Steps |
10 tasks
Member
Author
|
Closing this since a better proposal has come up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Main flyout positioning (
flyout.styles.ts)right: var(--euiFlyoutOffsetInlineEnd, 0)calc(Xvw - X * var(--euiFlyoutOffsetInlineEnd, 0px))calc((90vw - 0.9 * var(--euiFlyoutOffsetInlineEnd, 0px)) - [sibling-width]px)calc(90vw - 0.9 * var(--euiFlyoutOffsetInlineEnd, 0px))Child flyout positioning (
flyout_child.tsx)right: calc([parent-width]px + var(--euiFlyoutOffsetInlineEnd, 0px))Layout mode logic (
layout_mode.ts)useEuiThemeCSSVariables().globalCSSVariablesto read offset valueeffectiveViewportWidth = windowWidth - flyoutOffseteffectiveViewportWidthfor both:getWidthFromSize()calculations to match CSS behaviorStorybook controls (
flyout_manager.stories.tsx,flyout_sessions.stories.tsx)flyoutOffsetcontrol (defaults to 0)useEuiThemeCSSVariables().setGlobalCSSVariables()to set--euiFlyoutOffsetInlineEndConsistent application
Documentation
packages/eui/src/components/flyout/README.md(developer docs)packages/website/docs/components/containers/flyout/index.mdx(public docs)useEuiThemeCSSVariables().setGlobalCSSVariables()Why are we making this change?
Screenshots #
Impact to users
QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@defaultif default values are missing) and playground toggles