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

[v3] Double quotes break arbitrary variants #13737

Closed
GitMazzone opened this issue May 23, 2024 · 2 comments
Closed

[v3] Double quotes break arbitrary variants #13737

GitMazzone opened this issue May 23, 2024 · 2 comments

Comments

@GitMazzone
Copy link

What version of Tailwind CSS are you using?

v3.4.3

What build tool (or framework if it abstracts the build tool) are you using?

Just using Tailwind CLI

What version of Node.js are you using?

v18.17.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

Link to Tailwind Play

Describe your issue

I found that while trying to use an arbitrary selector (to choose a child by role attribute) you must use single quotes. Double quotes break the selector.

@GitMazzone GitMazzone changed the title [v3] [v3] Double quotes break arbitrary selector May 23, 2024
@GitMazzone GitMazzone changed the title [v3] Double quotes break arbitrary selector [v3] Double quotes break arbitrary variants May 23, 2024
@wongjn
Copy link
Contributor

wongjn commented May 24, 2024

You can use double quotes, as long as you don't use double-quotes for the class attribute quotes. This is because the browser would see the matching double-quote as closing the attribute value. Alternatively, you can also use no quotes at all. Tailwind Play examples.

@adamwathan
Copy link
Member

As @wongjn mentioned, the browser isn't able to parse your HTML correctly because you are trying to nest double quotes:

image

It thinks you're writing this:

<div
  class="[&_[role="
  separator"]]:bg-green-500"
>

...and sees "&_[role=" as the entire class attribute, because the quote after role= is treated as the closing quote for the class attribute.

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

No branches or pull requests

3 participants