Reposition onboarding popover when pins change

What does this MR do and why?

On the Feature catalog step of the tailored navigation onboarding, unpinning an item moves the "Browse all features" button up, but the popover stays where it was and points at nothing.

GlPopover's Popper.js instance only repositions on window resize and scroll, not when its target moves because the layout changed. GitLab UI has no public API to reposition a popover. The component already uses :key="step" to re-anchor between steps, so this MR uses the same approach: the popover now remounts on the Feature catalog step whenever the pinned items change.

  • tailored_navigation_onboarding_popover.vue: new optional catalogLayoutKey prop, included in the popover key on the catalog step only. The first step is anchored at the top of the sidebar and doesn't remount.
  • sidebar_menu.vue: passes the current pinned item IDs as catalogLayoutKey.

Focus is not stolen on remount, because the existing focusOnShow logic only focuses the popover on a step's first show.

Known limitations:

  • The popover briefly fades out and back in when it remounts.
  • Collapsing or expanding an auto-grouped pinned category doesn't change the pins, so it doesn't trigger a reposition.

References

Screenshots or screen recordings

Before After
Popover left floating after unpinning Popover moved

How to set up and validate locally

  1. Enable the feature flag in the Rails console: Feature.enable(:hide_unpinned_sidebar_items).
  2. Make sure the onboarding callout is not dismissed for your user, for example: Users::Callout.where(user: User.find_by_username('root'), feature_name: 'tailored_navigation_onboarding').delete_all.
  3. Open a project with a few pinned items, with the sidebar docked and expanded.
  4. In the onboarding popover, select Next to go to step 2, which points at Browse all features.
  5. Unpin an item from the sidebar.
  6. Verify the popover moves with the Browse all features button instead of staying where it was.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Austin Regnery

Merge request reports

Loading
Loading