Skip to content

Commit

Permalink
fix(overlay): skip disable & upgrade platform (#20647)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Timer authored Dec 31, 2020
1 parent 44ee7de commit e4a7446
Show file tree
Hide file tree
Showing 4 changed files with 3,571 additions and 17 deletions.
3 changes: 2 additions & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @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'

Expand Down Expand Up @@ -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])
Expand Down
Loading

0 comments on commit e4a7446

Please sign in to comment.