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

Unwanted div created for client only pages using NuxtLayout + NuxtPage #30344

Open
abaza738 opened this issue Dec 23, 2024 · 4 comments
Open

Comments

@abaza738
Copy link

abaza738 commented Dec 23, 2024

Environment


  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: 3.14.1592
  • CLI Version: 3.17.1
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: default
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-2xmgnqmb?file=pages%2FAbout.client.vue

Describe the bug

With a layout that depends on CSS flexbox, some client only pages are broken because there seems to be a div element created by either NuxtLayout or NuxtPage possibly that is not a flex element. This ruins the page layout for my application.

The reproduction shows two pages, the index.vue page which fills the whole page, and About.vue which does not fill the whole page.

Additional context

In /about, the additional div is highlighted here in the following image.

Image

While in the home page, you do not see the additional div, instead, the .page element is a direct child of #__nuxt.

Image

Copy link

stackblitz bot commented Dec 23, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

This is how client-only pages are implemented and is less a bug than a limitation. We could document this, though obviously I would prefer to remove the limitation if possible.

@abaza738
Copy link
Author

If there's a way to add style to this div, we could solve the problem by adding display: contents;.

@cernymatej
Copy link
Contributor

display: contents has very bad browser support
I think it would be probably better to allow adjusting the styles similar to how the useHead composable allows editing bodyAttrs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants