Skip to content

docs: example code causes node_invalid_placement_ssr warning. This fixes the issue#1837

Closed
benquan wants to merge 1 commit into
huntabyte:mainfrom
benquan:patch-1
Closed

docs: example code causes node_invalid_placement_ssr warning. This fixes the issue#1837
benquan wants to merge 1 commit into
huntabyte:mainfrom
benquan:patch-1

Conversation

@benquan
Copy link
Copy Markdown

@benquan benquan commented Apr 20, 2025

this Button element causes this warning:

node_invalid_placement_ssr: `<button>` (src/lib/components/ui/button/button.svelte:60:1) cannot be a child of `<button>` (node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte:34:2)

This can cause content to shift around as the browser repairs the HTML, and will likely result in a `hydration_mismatch` warning.

This change fixes #1635

this Button element causes this warning: 
```node_invalid_placement_ssr: `<button>` (src/lib/components/ui/button/button.svelte:60:1) cannot be a child of `<button>` (node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte:34:2)

This can cause content to shift around as the browser repairs the HTML, and will likely result in a `hydration_mismatch` warning.```

This change fixes huntabyte#1635
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2025

⚠️ No Changeset found

Latest commit: ae0a580

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@shyakadavis
Copy link
Copy Markdown
Contributor

@benquan when you first ran into the issue you're trying to fix, what versions of bits-ui and svelte were you using?

Because I don't think this issue existed pre-svelte5 and/or pre-bits-ui1.0.

@benquan
Copy link
Copy Markdown
Author

benquan commented Apr 21, 2025

@benquan when you first ran into the issue you're trying to fix, what versions of bits-ui and svelte were you using?

Because I don't think this issue existed pre-svelte5 and/or pre-bits-ui1.0.

I am using the latest

	"bits-ui": "^1.3.19",
	"svelte": "^5.28.1",

@shyakadavis
Copy link
Copy Markdown
Contributor

I am using the latest

Interesting. Then why are you making changes targeting Svelte 4 and Bits-UI 0.x?

Since you're on the latest, I recommend using the child snippet to fix the issue.

e.g. https://bits-ui.com/docs/components/dropdown-menu#svelte-transitions

@huntabyte huntabyte closed this May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node_invalid_placement_ssr: <button> ... cannot be a child of <button>

3 participants