Allow for arbitrary and multiple selectors in aria- variant definitions
#11613
MichaelAllenWarner
started this conversation in
Ideas
Replies: 1 comment
-
|
I suppose that because of the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, the
aria-variant settings only allow for simple single-string values that get inserted into the`&[aria-${normalize(value)}]`string here: https://github.com/tailwindlabs/tailwindcss/blob/master/src/corePlugins.js#L414-L432This is a bit limiting.
For example, it's quite sensible to define a custom
aria-currentvariant with a selector like&[aria-current]:not([aria-current="false"]), but currently this couldn't be achieved in theariatheme-setting (would have to be done in separate customaddVariant()/matchVariant()plugins).Likewise, out of the box, Tailwind's
aria-pressedandaria-checkedvariants both get"true"values for their corresponding attribute, but both attributes also support a"mixed"value (in addition to"true"and"false"). One could conceivably want a single variant to cover the non-"false"cases, in which case again you'd need separate customaddVariant()/matchVariant()plugins with a selector like&[aria-pressed]:not([aria-pressed="false"]).I propose adding an advanced option for the
aria-variant definitions, where the user can supply a value whose type is the same type as the second parameter foraddVariant()—namely, a selector or array of selectors with the&syntax. This would give users greater flexibility without having to define their more complexaria-variants elsewhere in the config file.If the Tailwind folks are interested in the idea, I could probably find time to contribute here.
Beta Was this translation helpful? Give feedback.
All reactions