Skip to content

feat(popover-menu): add reveal animation - #8305

Draft
nuria1110 wants to merge 2 commits into
masterfrom
FE-7858
Draft

nuria1110 wants to merge 2 commits into
masterfrom
FE-7858

Conversation

@nuria1110

Copy link
Copy Markdown
Contributor

Proposed behaviour

Adds reveal animation to internal popover-menu component, which is consumed by ActionPopover, MultiActionButton, SplitButton, Select, Search.

Current behaviour

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The reveal animation uses scaled height measurements that clip items and cause visual jumps, and its clipping region can obscure keyboard-opened submenus while focus moves into them.

2 open issues
What changed in this PR

Adds a reveal animation to the shared internal popover menu used by ActionPopover, MultiActionButton, SplitButton, Select, and Search.

Changes:

  • Separates menu positioning from animated content, measures reveal height, and respects reduced-motion preferences.
  • Adds transition completion handling and a timeout fallback.
  • Updates unit tests for reveal behavior and the new content wrapper.
File Description
src/​components/​action-popover/​action-popover.test.tsx Moves padding assertions to the menu content wrapper.
src/​__internal__/​popover-menu/​popover-menu.test.tsx Adds reveal, reduced-motion, and transition completion tests.
src/​__internal__/​popover-menu/​popover-menu.component.tsx Implements reveal styling, height measurement, lifecycle handling, and wrapper references.

Review effort: Balanced

@nuria1110 nuria1110 added the Work in progress This is a WIP PR so may not be ready for review label Nov 24, 2026
@nuria1110
nuria1110 force-pushed the FE-7858 branch 2 times, most recently from 00f5c28 to 0a2e299 Compare December 3, 2026 09:49
@nuria1110 nuria1110 removed the Work in progress This is a WIP PR so may not be ready for review label Dec 3, 2026
Adds reveal animation to internal popover-menu component, which is consumed by ActionPopover,
MultiActionButton, SplitButton, Select, Search.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The reveal transition lacks targeted Playwright coverage for height, clipping, and placement, leaving browser layout regressions unchecked near viewport edges, selected-option visibility untested when reopening a virtualised Select, and reduced-motion behavior unverified. The new padding: 0 also bypasses the spacing token scale; use var(--global-space-none) as the component already does elsewhere.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment on lines +122 to +125
transition:
height ${revealEasing},
padding-top ${revealEasing},
padding-bottom ${revealEasing};
${$contentHeight === undefined
? css`
height: 0;
padding: 0;

@DipperTheDan DipperTheDan left a comment

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.

Nothing more to add from me. Just address the comments left by Copilot and I'll approve the work 👍🏻


test("when reopening the select after selecting an option, the selected option is visible", async ({
// skip due to flakiness - FE-7905
test.skip("when reopening the select after selecting an option, the selected option is visible", async ({

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.

comment: I don't think we can skip this as this PR is adding the change that's causing the regression. It leaves 18px clipped after the animation ends. I think it's that you removed max-width: 100% on the inner container, the list can initially render wider, scroll the selected option into view, then wrap text when its final width applies.

@edleeks87 edleeks87 Dec 4, 2026 •

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.

suggestion (non-blocking): add the following before we scroll in this test as it will prevent flakiness

await expect(page.getByTestId("menu-content")).toHaveCSS(
  "transition-duration",
  "0s",
);

useResizeObserver(internalListRef, updateContentHeight, !isRevealingActive);

// restarts on each content height change so the reveal ends once the latest transition completes
useEffect(() => {

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.

comment: The reveal should run once when the menu opens, with a fixed completion time. Depending on contentHeight here restarts the timeout on each resize and can extend the reveal beyond that window. Could we start the timer on the first measurement and avoid resetting it for subsequent height changes?

const hasMeasuredContent = contentHeight !== undefined;

useEffect(() => {
  if (!isRevealingActive || !hasMeasuredContent) return undefined;

  const timeoutId = setTimeout(
    () => setIsRevealing(false),
    REVEAL_DURATION + 50,
  );

  return () => clearTimeout(timeoutId);
}, [isRevealingActive, hasMeasuredContent]);

rectSpy.mockRestore();
});

describe("when animating the menu", () => {

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.

comment: I think we need to add a test that covers that resizes partway through the opening reveal and verify that it does not restart the timer: revealing should end at the original deadline. Also verify that content changes after completion do not reactivate the animation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants