Skip to content

fix: narrow react/react-dom peerDependencies to drop false React 16 claim - #6323

Draft
SaiBalaji202 wants to merge 1 commit into
Hacker0x01:mainfrom
SaiBalaji202:issue-6321/fix/react16-peer-dependency
Draft

fix: narrow react/react-dom peerDependencies to drop false React 16 claim#6323
SaiBalaji202 wants to merge 1 commit into
Hacker0x01:mainfrom
SaiBalaji202:issue-6321/fix/react16-peer-dependency

Conversation

@SaiBalaji202

Copy link
Copy Markdown

Description

Linked issue: #6321

Problem

package.json peerDependencies still claim React 16 support
(^16.9.0 || ^17 || ^18 || ^19), but our positioning dependency, @floating-ui/react,
dropped React 16 support as of its 0.27.0 release — the installed
@floating-ui/react already declares peerDependencies: { react: ">=17.0.0" }. Every
React 16 install of react-datepicker has been getting an npm warn peer-dependency
error since @floating-ui/react was bumped past 0.27.0 in #5268, for a React version
we don't actually support end-to-end.

Why floating-ui dropped React 16

Traced to floating-ui/floating-ui#3103
(purely a peerDependencies/changeset bump — no source changed), which closes
floating-ui/floating-ui#3092
(WONTFIX): on React 16, nested FloatingPortals need two clicks to dismiss instead of
one. React 16 attaches synthetic event listeners to document; React 17+ attaches them
to the root container instead, and floating-ui's useDismiss + FloatingPortal
outside-click logic relies on the React 17+ attachment point.

Does this bug reach react-datepicker?

No. src/with_floating.tsx only imports useFloating/autoUpdate/flip/offset/
arrow from @floating-ui/react — pure positioning. It never imports useDismiss or
FloatingPortal; outside-click handling here is our own ClickOutsideWrapper. So the
one documented React-16 regression upstream can't fire through this codebase's usage.

Fix

Metadata-only — no runtime code changes, since the code path that could have broken was
never used:

  • package.json — narrow react/react-dom peerDependencies to ^17 || ^18 || ^19 || ^19.0.0-rc, matching @floating-ui/react's own floor.
  • yarn.lock — regenerated so the workspace metadata matches.
  • README.md — the "Compatibility" table repeated the same stale "React 16 or newer" claim for current versions; added a line clarifying versions after v9.1.0 require React 17+.

Note for reviewers

Narrowing a peerDependencies range is itself semver-breaking for anyone still on
React 16, even though application code is untouched — npm/pnpm peer resolution can go
from a soft warning to a hard install failure for those installs. Worth calling that out
explicitly in release notes rather than shipping it as an invisible patch (i.e. this
probably wants to land as at least a semver-minor with a changelog note, if not paired
with a major bump).

Contribution checklist

  • I have followed the contributing guidelines.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.
  • yarn type-check, yarn eslint, and yarn test (1485/1485 tests, 43/43 suites) all pass unchanged.

…laim

Fixes Hacker0x01#6321

package.json peerDependencies still claimed React 16 support
("^16.9.0 || ^17 || ^18 || ^19"), but our positioning dependency,
@floating-ui/react, dropped React 16 as of its 0.27.0 release
(peerDependencies: react: ">=17.0.0", verified in the installed
node_modules/@floating-ui/react/package.json). The mismatch was
introduced in Hacker0x01#5268, a dependabot bump of @floating-ui/react that
updated the dependency without updating our own peerDependencies
floor. Every React 16 install has been getting an npm peer-dependency
warning since that bump, for a version range we don't actually
support.

Why floating-ui dropped it: floating-ui/floating-ui#3103 (closing
floating-ui/floating-ui#3092, WONTFIX) — React 16 attaches synthetic
event listeners to `document`, React 17+ attaches them to the root
container instead. floating-ui's useDismiss + FloatingPortal
outside-click logic depends on the React 17+ attachment point, so
nested portals need two clicks to dismiss on React 16 instead of one.

Does this repo hit that bug? No: src/with_floating.tsx only imports
useFloating/autoUpdate/flip/offset/arrow (positioning) and never
useDismiss or FloatingPortal — outside-click is handled by our own
ClickOutsideWrapper instead. So the one known React-16 bug upstream
can't fire through this codebase's usage. This fix is metadata-only;
no runtime code changes, since the code path that could have broken
was never used.

Also updated the React compatibility table in README.md, which
repeated the same "React 16 or newer" claim for current versions.

Note for reviewers: narrowing a peerDependencies *range* is itself
semver-breaking for anyone still on React 16, even though application
code is untouched here — npm/pnpm peer resolution can go from a soft
warning to a hard install failure for those installs. Worth calling
out in release notes rather than shipping as an invisible patch.

Verified: yarn type-check, yarn eslint, and yarn test (1485/1485,
43/43 suites) all pass unchanged on this branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcacPbehewGNsFHmrLeA6j
@SaiBalaji202
SaiBalaji202 marked this pull request as draft August 24, 2026 06:14
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