From 7812b5302a7f6df031be85aa80820ce4ec2b6ee8 Mon Sep 17 00:00:00 2001 From: Balaji Sridharan Date: Mon, 24 Aug 2026 11:43:56 +0530 Subject: [PATCH] fix: narrow react/react-dom peerDependencies to drop false React 16 claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #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 #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 Claude-Session: https://claude.ai/code/session_01TcacPbehewGNsFHmrLeA6j --- README.md | 4 +++- package.json | 4 ++-- yarn.lock | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index def0ed701..266315085 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,9 @@ We're always trying to stay compatible with the latest version of React. We can' Latest compatible versions: -- React 16 or newer: React-datepicker v2.9.4 and newer +- React 17 or newer: React-datepicker versions after v9.1.0 (React 16 is no longer supported — our + positioning dependency, `@floating-ui/react`, dropped React 16 support in its `0.27.0` release) +- React 16 or newer: React-datepicker v2.9.4 up to v9.1.0 - React 15.5: React-datepicker v2.9.3 - React 15.4.1: needs React-datepicker v0.40.0, newer won't work (due to react-onclickoutside dependencies) - React 0.14 or newer: All above React-datepicker v0.13.0 diff --git a/package.json b/package.json index 30026f5d9..79aae4b3e 100644 --- a/package.json +++ b/package.json @@ -98,8 +98,8 @@ }, "peerDependencies": { "date-fns-tz": "^3.0.0", - "react": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc", - "react-dom": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc" + "react": "^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^17 || ^18 || ^19 || ^19.0.0-rc" }, "peerDependenciesMeta": { "date-fns-tz": { diff --git a/yarn.lock b/yarn.lock index f8c70e45d..df580b8a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8867,8 +8867,8 @@ __metadata: typescript-eslint: "npm:^8.22.0" peerDependencies: date-fns-tz: ^3.0.0 - react: ^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc - react-dom: ^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc + react: ^17 || ^18 || ^19 || ^19.0.0-rc + react-dom: ^17 || ^18 || ^19 || ^19.0.0-rc peerDependenciesMeta: date-fns-tz: optional: true