Skip to content

Commit

Permalink
Add data attribute to div to distinguish it (#41889)
Browse files Browse the repository at this point in the history
Makes it clearer why this is added by Next.js and allows searching for
it in the docs.

You can learn more about why here:
https://beta.nextjs.org/docs/routing/linking-and-navigating#focus-and-scroll-management

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
timneutkens committed Oct 27, 2022
1 parent 0ab2bed commit c6107a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next/client/components/layout-router.tsx
Expand Up @@ -240,7 +240,9 @@ export function InnerLayoutRouter({

// Ensure root layout is not wrapped in a div as the root layout renders `<html>`
return rootLayoutIncluded ? (
<div ref={focusAndScrollElementRef}>{subtree}</div>
<div ref={focusAndScrollElementRef} data-nextjs-scroll-focus-boundary={''}>
{subtree}
</div>
) : (
subtree
)
Expand Down

0 comments on commit c6107a9

Please sign in to comment.