Skip to content

feat!: replace Popper with Floating UI - #3

Merged
SimonSchick merged 3 commits into
masterfrom
feat/floating-ui
Nov 12, 2026
Merged

SimonSchick merged 3 commits into
masterfrom
feat/floating-ui

Conversation

@SimonSchick

Copy link
Copy Markdown

Replaces @popperjs/core, which has had no release since 2023, with Floating UI (@floating-ui/react-dom). Bootstrap 6 makes the same move.

There is no Popper-shaped shim: src/popper.tsx (react-popper's Manager/Reference/Popper API) is deleted, and components call useFloating directly.

  • FloatingContent, which replaces PopperContent, positions Tooltip and Popover with offset, then flip or autoPlacement, then shift and arrow.
  • DropdownMenu floats against the toggle element, which Dropdown now keeps in state and shares through context, using flip and shift.
  • The menu, tooltip and popover elements still get data-popper-placement, and the menu still gets data-bs-popper. These attributes are Bootstrap 5's CSS hooks, not Popper's.

Also removes docs.yml: GitHub Pages can't be published here.

Breaking (11.0.0)

Before After
PopperContent, PopperContentProps FloatingContent, FloatingContentProps (+ FloatingPlacement)
popperClassName floatingClassName
modifiers (Popper modifiers) middleware (Floating UI; same-named entries replace defaults)
offset={[skid, dist]} Floating UI OffsetOptions: 8, or { mainAxis, crossAxis }. Popover default 8
boundariesElement boundary (default 'clippingAncestors')
data-popper-reference-hidden, Util.PopperPlacements removed

placement="auto*" still works, via autoPlacement. Fix: DropdownToggle's innerRef was dropped inside a navbar and now works there too.

ConCat needs one line changed: PopperContent.defaultProps.offset = [0, 5] becomes FloatingContent.defaultProps.offset = 5.

Test plan

  • npm run typecheck, lint, format:check
  • npm run test:ci: 850 tests. A useFloating spy (real implementation) replaces the Popper mock.
  • npm run build: @floating-ui/react-dom is the only positioning dependency; no popperjs in dist/
  • npm run build:docs
  • Real Chromium against Storybook builds of master (Popper) and this branch, comparing the measured placement and the box sizes and positions of the floating element and its arrow. Covered: tooltip, popover and dropdown stories (directions, auto, flip). Every case matches except one 1px sub-pixel rounding difference on a left tooltip.
  • ConCat on 11.0.0 after publish

🤖 Generated with Claude Code

SimonSchick and others added 3 commits November 11, 2026 20:16
Pages can't be published for this repo; docs run locally via `npm start`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@popperjs/core is unmaintained since 2023. Tooltip, Popover and DropdownMenu
now call `useFloating` from @floating-ui/react-dom directly; the react-popper
style `popper.tsx` shim is gone.

BREAKING CHANGE: `PopperContent` → `FloatingContent`, `popperClassName` →
`floatingClassName`, `modifiers` → `middleware`, `boundariesElement` →
`boundary`, `offset` takes Floating UI `OffsetOptions` (Popover default 8).
`data-popper-reference-hidden` and `Util.PopperPlacements` are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Same-named user middleware replaces the default in its slot (a custom
  `offset` now runs before flip/shift); falsy entries are skipped.
- `shift` uses `limitShift()`, matching Popper's `preventOverflow` tether.
- `auto-start`/`auto-end` keep their alignment (`autoAlignment: false`).
- DropdownToggle re-applies a swapped `innerRef`.
- Tests for order, tether, arrow positioning, updateOnSelect, toggle
  reference and innerRef; CHANGELOG gaps filled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SimonSchick
SimonSchick merged commit 37af5d2 into master Nov 12, 2026
1 check 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.

1 participant