fix: a11y issues in the overlay component (HMR) (#49782)
This is a follow-up PR for #49460.
I've fixed some a11y issues at #49460, but I've noticed that Next has other overlay implementations.
So I've applied that into another implementation, which seems to be for HMR overlay.
There is another overlay implementation for Turbopack, so I'll fix it later.
- https://github.com/vercel/next.js/tree/canary/packages/react-dev-overlay/src/internal
- https://github.com/vercel/next.js/tree/canary/packages/next/src/client/components/react-dev-overlay/internal
- https://github.com/vercel/next.js/tree/canary/packages/next-swc/crates/next-core/js/src/overlay/internal
I couldn't get the way to run an application with `--turbo` in the monorepo by `next-with-deps`. I tried `pnpm next-with-deps --turbo ./examples/app-dir-mdx`, but I've got the `Error: Cannot find module 'next/dist/server/node-polyfill-fetch'` error and couldn't fix it. I tried building `next-swc` by `pnpm build-native`, but couldn't fix the error.
How can I run a local application with `--turbo`?
I expect this is a temporary fix because it would be nice if I could remove duplicated components by removing duplicated components and importing from one place.
I feel `packages/react-dev-overlay` is the right place for this because it's a separate package. But `packages/react-dev-overlay` imports some modules from `next/dist/client/components/react-dev-overlay/`, which is an opposite dependency.
e.g. https://github.com/vercel/next.js/blob/afddb6ebdade616cdd7780273be4cd28d4509890/packages/react-dev-overlay/src/client.ts#L3
I've also found `@next/react-dev-ovrelay` is imported from `package/next` as a combiled package like `next/dist/compiled/@next/react-dev-overlay/dist/client`
- https://github.com/vercel/next.js/blob/afddb6ebdade616cdd7780273be4cd28d4509890/packages/next/src/client/dev/error-overlay/hot-dev-client.ts#L31-L37
- https://github.com/vercel/next.js/blob/afddb6ebdade616cdd7780273be4cd28d4509890/packages/next/src/server/dev/next-dev-server.ts#L61-L66
What do you think? I'll work on this if it makes sense.