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

Nested css breaks when using pseudo-elements #15668

Open
thomas-daughters opened this issue Apr 1, 2025 · 0 comments
Open

Nested css breaks when using pseudo-elements #15668

thomas-daughters opened this issue Apr 1, 2025 · 0 comments
Labels
browser specific css Stuff related to Svelte's built-in CSS handling

Comments

@thomas-daughters
Copy link

thomas-daughters commented Apr 1, 2025

Describe the bug

When using scoped styles in Svelte, placeholder pseudo-elements like ::placeholder are compiled to selectors such as:

input:where(.s-abc123)::placeholder

This pattern fails to apply in Safari (tested in Safari 16.6 and 17.0 on macOS and iOS). The issue appears to be that Safari does not recognise ::placeholder correctly when it is placed after a :where(...) pseudo-class, especially if that pseudo-class holds the scoped class.

Looks OK in Chrome, interestingly.

Reproduction

Given the following scoped Svelte style:

<input type="text" placeholder="Search..." />

<style>
	input {
		&::placeholder {
			color: gray;
		}
	}
</style>

Svelte compiles it to:

input:where(.s-xyz)::placeholder {
	color: gray;
}

Logs

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M2
    Memory: 126.42 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
  Browsers:
    Safari: 18.3.1

Severity

annoyance

@dummdidumm dummdidumm added css Stuff related to Svelte's built-in CSS handling browser specific labels Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser specific css Stuff related to Svelte's built-in CSS handling
Projects
None yet
Development

No branches or pull requests

2 participants