未验证 提交 e4a74465 编写于 作者: J Joe Haddad 提交者: GitHub

fix(overlay): skip disable & upgrade platform (#20647)

This bundles ally.js into Next.js itself to upgrade a dependency they have pinned.

I tried every other major focus trap solution, even those used by some modal libraries, and they all failed.

`ally.js` is the only library that can do it correctly, so we're going to stick with it.

I also removed the `maintain/disabled` as we have a backdrop that would effectively result in the same. This reduces CPU strain.

---

Fixes #19893
Fixes #14369
Closes #14372
上级 44ee7de6
......@@ -17,11 +17,12 @@
},
"dependencies": {
"@babel/code-frame": "7.12.11",
"ally.js": "1.4.1",
"anser": "1.4.9",
"chalk": "4.0.0",
"classnames": "2.2.6",
"css.escape": "1.5.1",
"data-uri-to-buffer": "3.0.1",
"platform": "1.3.6",
"shell-quote": "1.7.2",
"source-map": "0.8.0-beta.0",
"stacktrace-parser": "0.1.10",
......
// @ts-ignore
import allyDisable from 'ally.js/maintain/disabled'
// @ts-ignore
import allyTrap from 'ally.js/maintain/tab-focus'
import allyTrap from './maintain--tab-focus'
import * as React from 'react'
import { lock, unlock } from './body-locker'
......@@ -29,10 +27,8 @@ const Overlay: React.FC<OverlayProps> = function Overlay({
return
}
const handle1 = allyDisable({ filter: overlay })
const handle2 = allyTrap({ context: overlay })
return () => {
handle1.disengage()
handle2.disengage()
}
}, [overlay])
......
......@@ -3453,13 +3453,6 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.5.5:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ally.js@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/ally.js/-/ally.js-1.4.1.tgz#9fb7e6ba58efac4ee9131cb29aa9ee3b540bcf1e"
dependencies:
css.escape "^1.5.0"
platform "1.3.3"
alphanum-sort@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
......@@ -5558,9 +5551,10 @@ css-what@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.2.1.tgz#f4a8f12421064621b456755e34a03a2c22df5da1"
css.escape@^1.5.0:
css.escape@1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb"
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
css@^2.0.0:
version "2.2.4"
......@@ -11936,9 +11930,10 @@ pkg-up@^3.0.1:
dependencies:
find-up "^3.0.0"
platform@1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.3.tgz#646c77011899870b6a0903e75e997e8e51da7461"
platform@1.3.6:
version "1.3.6"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
please-upgrade-node@^3.2.0:
version "3.2.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册