Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-nextjs-scroll-focus-boundary appears multiple times #42707

Closed
1 task done
BWBama85 opened this issue Nov 9, 2022 · 9 comments
Closed
1 task done

data-nextjs-scroll-focus-boundary appears multiple times #42707

BWBama85 opened this issue Nov 9, 2022 · 9 comments
Labels
bug Issue was opened via the bug report template.

Comments

@BWBama85
Copy link

BWBama85 commented Nov 9, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.12.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.0.3-canary.2
      eslint-config-next: 13.0.2
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

npm run build on personal server

Describe the Bug

This occurs with npm run dev and npm run build.

data-nextjs-scroll-focus-boundary

Appears multiple times nested when using a component with 'use client'

Expected Behavior

It should only appear once.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://git.thewilsonnet.com/thewilsonnet/thewilsonnet.com

To Reproduce

Clone repo
npm install
npm run dev or deploy.

Go to /about/resume

Live example: https://thewilsonnet.com/about/resume

@BWBama85 BWBama85 added the bug Issue was opened via the bug report template. label Nov 9, 2022
@balazsorban44
Copy link
Member

Hi, this is currently expected, as each segment introduces its own boundary.

Refer to the docs: https://beta.nextjs.org/docs/routing/linking-and-navigating#focus-and-scroll-management

@trevorpfiz
Copy link

Interesting. If I want to have my header stay at the top of the screen what should I do? It does not change on navigation so it is hidden at the top of the screen, and I am scrolled to the element below it that has changed.

@BWBama85
Copy link
Author

Interesting. If I want to have my header stay at the top of the screen what should I do? It does not change on navigation so it is hidden at the top of the screen, and I am scrolled to the element below it that has changed.

Right, this is very annoying.

@madeleineostoja
Copy link

I think this should be reopened because the current behaviour completely breaks any layout relying on css grid or similar, by nesting an arbitrary number of divs inside the parent.

@birkj
Copy link

birkj commented Nov 21, 2022

Found a fix by adding this to my globals.css

@layer base {
  [data-nextjs-scroll-focus-boundary] {
    display: contents;
  }
}

@beckblakestrom
Copy link

Similar to @birkj , just added display: contents to the div in global.css

[data-nextjs-scroll-focus-boundary] { display: contents; }

@bradennapier
Copy link

bradennapier commented Nov 29, 2022

This seems like how it should have been implemented from the start, but also may break some of twhat next team is planning to do with advanced routings (definitely will).

I think instead they are going to have to do something like use display: contents on the div then use that to do the focus-trap on the first child box that isn't a focus trap boundary or something

agree though - reminds me of the days before <></> cringe

@danieljpgo
Copy link

It was fixed in the last canary

#43717

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

8 participants