Skip to content

[Flyout System] A "push" flyout session keeps page content pushed even when it's no longer the active session #9159

@tsullivan

Description

@tsullivan

Reported by @tsullivan

Describe the bug

Background: When an EuiFlyout type prop is set to push, the page content is pushed to the side. In the Flyout System, the flyout manager coordinates multiple sessions of EuiFlyouts.

Bug: If a preliminary session is set with push, and a subsequent flyout session is set to overlay, the page content is not being "unpushed" for the overlay flyout - it remains pushed.

Impact and severity

The UI appears incorrect for the overlay flyout rendering.

Environment and versions

Flyout System is still implemented only in the feat/flyout-system feature branch at the time of this writing

Minimum reproducible sandbox

const Demo: React.FC = () => {
  const [isFlyoutAOpen, setFlyoutAOpen] = useState(false);
  const [isFlyoutBOpen, setFlyoutBOpen] = useState(false);

  return (
    <>
      <EuiText>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui
          mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor
          neque eu tellus rhoncus ut eleifend nibh porttitor. Ut in nulla enim.
          Phasellus molestie magna non est bibendum non venenatis nisl tempor.
          Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor
          posuere. Praesent id metus massa, ut blandit odio. Proin quis tortor
          orci. Etiam at risus et justo dignissim congue. Donec congue lacinia
          dui, a porttitor lectus condimentum laoreet. Nunc eu ullamcorper orci.
          Quisque eget odio ac lectus vestibulum faucibus eget in metus. In
          pellentesque faucibus vestibulum. Nulla at nulla justo, eget luctus
          tortor. Nulla facilisi. Duis aliquet egestas purus in blandit.
        </p>
      </EuiText>
      <EuiSpacer size="m" />
      <EuiButton onClick={() => setFlyoutAOpen(true)}>Open Session A</EuiButton>
      <EuiSpacer size="s" />
      <EuiButton onClick={() => setFlyoutBOpen(true)}>Open Session B</EuiButton>
      {isFlyoutAOpen && (
        <EuiFlyout
          session="start"
          type="push"
          id="A"
          size="l"
          flyoutMenuProps={{ title: 'Flyout A' }}
          onClose={() => {
            action('Session A closed')();
            setFlyoutAOpen(false);
          }}
        >
          <EuiFlyoutBody>
            <EuiText>
              <p>This is the first flyout session with type set to push.</p>
            </EuiText>
          </EuiFlyoutBody>
        </EuiFlyout>
      )}
      {isFlyoutBOpen && (
        <EuiFlyout
          session="start"
          type="overlay"
          id="B"
          size="s"
          flyoutMenuProps={{ title: 'Flyout B' }}
          onClose={() => {
            action('Session B closed')();
            setFlyoutBOpen(false);
          }}
        >
          <EuiFlyoutBody>
            <EuiText>
              <p>This is the second flyout session with type set to overlay.</p>
            </EuiText>
          </EuiFlyoutBody>
        </EuiFlyout>
      )}
    </>
  );
};

To Reproduce

  1. Create a Storybook with the given Demo code
  2. Click the button to open Flyout A
  3. Click the button to open Flyout B
  4. When Flyout B is the active session, the space on the page that was created for Flyout A is still showing.

Expected behavior

Having an active flyout session that has the type set to overlay means that the page shouldn't have a gap where content is pushed over to the side.

Screenshots (Optional)

flyout.overlay.bug.9159.mov

Additional context (Optional)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions