Next.js: Swap out ally.js for focus-trap-react

Created on 19 Jun 2020  Â·  4Comments  Â·  Source: vercel/next.js

Feature request

Is your feature request related to a problem? Please describe.

In the discussions, a few of us have noticed some issues with the ally.js package that's imported in @next/react-dev-overlay.

I'm wondering if you'd be willing to swap our ally.js for focus-trap-react. It appears the only place where ally.js is used is in the @next/react-dev-overlay and in that package, ally.js is only being used to trap focus.

Describe the solution you'd like

…It seems like focus-trap-react is more _focused_ 😅

Its bundle size is much smaller too vs ally.js

Describe alternatives you've considered

There may be other libs I haven't considered but this one seems the most popular.

Additional context

If you're accepting, I'd be willing to throw this together — at least to experiment.

story

All 4 comments

Another idea could be just removing the focus trap feature all together. When the development overlay modal opens, we could just focus it without trapping.

I see that ally.js is not only being used to trap focus.

There next.js disables any type of user interaction, so focus-trap-react seems not to be correct replacement.
const handle1 = allyDisable({ filter: overlay })

Focus trapping is necessary for the DX of the overlay. Can you share more about this error? What specifically is going wrong?

@Timer ,

@chrisvariety had a repro for this issue here: https://github.com/vercel/next.js/discussions/14056#discussioncomment-28461

It has something to do with platform.js in ally.js.

—-

I think this issue should’ve been regarding that platform.js issue vs replacing ally.js with focus-trap-react (my bad!). I just saw that the bundle size for ally.js was relatively large and I thought I throw this idea out there for
potentially faster dev times but I’m running into an XY problem situation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flybayer picture flybayer  Â·  3Comments

jesselee34 picture jesselee34  Â·  3Comments

kenji4569 picture kenji4569  Â·  3Comments

sospedra picture sospedra  Â·  3Comments

pie6k picture pie6k  Â·  3Comments