@atlaskit/modal-dialog throws defaultProps warnings on newer React

modal-dialog throws the following console warning:

react-dom.development.js:86 Warning: LockToggle: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

It should be updated to use JS default params instead of defaultProps.

+1. Same error in console

Summary

Every Atlaskit modal dialog logs a React deprecation warning on open. The cause is the transitive dependency react-scrolllock@5.0.1, whose LockToggle function component still sets defaultProps. React 18.3 warns about it; React 19 removes the feature, so the modal’s body scroll lock silently stops working there. react-scrolllock is unmaintained (no activity since 2022) and 5.0.1 is its latest release, so the only upstream fix is for @atlaskit/modal-dialog to stop depending on it. This is the same warning reported in this thread in February 2025, still present in the latest release.

The warning

Warning: LockToggle: Support for defaultProps will be removed from function
components in a future major release. Use JavaScript default parameters instead.

Raised by react-scrolllock/dist/ScrollLock.js:

LockToggle.defaultProps = {
  accountForScrollbars: true,
  children: null,
  isActive: true
};

Impact

  • React 18.3: the warning is logged on every modal open, in every app that uses @atlaskit/modal-dialog.
  • React 19: defaultProps on function components is removed. isActive becomes undefined, LockToggle renders its children without SheetLock, and the page keeps scrolling behind an open modal.
  • It cannot be fixed on the application side without patching node_modules, because the code lives in a transitive dependency.

This is a very common warning class: the React 18.3 release turned it into a warning for every library still using defaultProps on function components (see the related reports at the end).

Dependency chain

Output of yarn why react-scrolllock:

my app (React 18.3.1, Vite 8.2.2)
└─ @atlaskit/modal-dialog@16.5.1        (direct dependency, "^16.5.1")
   └─ react-scrolllock@5.0.1            (declared by modal-dialog as "^5.0.1")
      └─ dist/ScrollLock.js: LockToggle.defaultProps = {...}

react-scrolllock is imported by @atlaskit/modal-dialog in:

  • dist/cjs/internal/components/modal-wrapper.js
  • dist/cjs/modal-body.js

The latest @atlaskit/modal-dialog on npm (16.6.5) still depends on react-scrolllock ^5.0.1, so upgrading does not remove the warning. react-scrolllock 5.0.1 is the latest published version of that package.

Component stack from the console

LockToggle        (react-scrolllock)
FocusLockUI       (react-focus-lock)
Portal / Layering / LevelProvider   (@atlaskit/portal, @atlaskit/layering)
ModalWrapper      (@atlaskit/modal-dialog)
<application modal>

The wrappers (react-focus-lock, @atlaskit/portal, @atlaskit/layering) only surround the failing component and do not cause the warning.

Steps to reproduce

  1. Create a React 18.3 app with @atlaskit/modal-dialog@16.5.1 (or 16.6.5).
  2. Render <ModalDialog> with any content and open it.
  3. Observe the warning above in the console on the first render.

Expected result

No deprecation warning. The scroll lock should use default parameters (or a defaults merge inside the function body) instead of defaultProps, so @atlaskit/modal-dialog keeps working on React 19.

Suggested fix

Either replace react-scrolllock inside @atlaskit/modal-dialog with a small internal body-scroll-lock hook (the package is unmaintained: its open items are unmerged Dependabot bumps from 2021-2022 and a React 17 update PR), or vendor a fixed copy of LockToggle with the same “apply a default only when the prop is undefined” semantics:

var LOCK_TOGGLE_DEFAULT_PROPS = {
  accountForScrollbars: true,
  children: null,
  isActive: true
};

var LockToggle = function LockToggle(inputProps) {
  var props = Object.assign({}, inputProps);
  Object.keys(LOCK_TOGGLE_DEFAULT_PROPS).forEach(function (key) {
    if (props[key] === undefined) {
      props[key] = LOCK_TOGGLE_DEFAULT_PROPS[key];
    }
  });
  return props.isActive ? React.createElement(SheetLock, props) : props.children;
};

Current workaround

A yarn patch on react-scrolllock@5.0.1 that applies the change above. Anyone else hitting this can do the same with yarn patch react-scrolllock (Yarn Berry) or patch-package (npm). It would be good to get a React 19 compatibility plan for @atlaskit/modal-dialog so the patch can be dropped.

Environment

Package Version
react / react-dom 18.3.1
@atlaskit/modal-dialog 16.5.1 (latest 16.6.5 has the same dependency)
react-scrolllock 5.0.1 (latest)
Vite 8.2.2
App type Forge Custom UI (Jira)

Thanks for the detailed report and investigation. The warning originates from react-scrolllock@5.0.1 indeed. Modal Dialog is being migrated to a new native body-scroll-lock implementation that no longer uses react-scrolllock.

We’re hoping to begin a staged rollout over the coming month. We don’t have a specific npm release or firm date to share yet, but we’ll update this thread when the change becomes available to external consumers.