Skip to content

Fix: Narrow react/react-dom peerDependencies to drop false React 16 claim - #6324

Open
balajis-qb wants to merge 2 commits into
Hacker0x01:mainfrom
qburst:issue-6321/fix/react16-peer-dependency
Open

Fix: Narrow react/react-dom peerDependencies to drop false React 16 claim#6324
balajis-qb wants to merge 2 commits into
Hacker0x01:mainfrom
qburst:issue-6321/fix/react16-peer-dependency

Conversation

@balajis-qb

Copy link
Copy Markdown
Contributor

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>
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.31%. Comparing base (548a1f3) to head (56d4924).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6324      +/-   ##
==========================================
+ Coverage   99.29%   99.31%   +0.02%     
==========================================
  Files          30       30              
  Lines        3822     3822              
  Branches     1648     1668      +20     
==========================================
+ Hits         3795     3796       +1     
+ Misses         26       25       -1     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…dencies

The docs-site lockfile (separate from the root yarn.lock) still cached
the old '^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc' peerDependencies
range for the portal:../ react-datepicker package after 7812b53
narrowed it in root package.json. CI's 'yarn --cwd docs-site install'
runs in hardened mode on public PRs and refuses to auto-fix a stale
lockfile, causing the Install docs dependencies job to fail.
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