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

Add support for peer and group variants on aria-* variants #3691

Open
4 tasks done
Johnkat-Mj opened this issue Apr 5, 2024 · 0 comments
Open
4 tasks done

Add support for peer and group variants on aria-* variants #3691

Johnkat-Mj opened this issue Apr 5, 2024 · 0 comments

Comments

@Johnkat-Mj
Copy link
Contributor

Johnkat-Mj commented Apr 5, 2024

Clear and concise description of the problem

Currently, Unocss does not support applying utility variants for ARIA attributes (such as aria-expanded) in conjunction with peer or group selectors. This means we cannot style elements based on the state of a related element using ara-* variants within peer or group selectors

Suggested solution

Extending Unocss to allow using peer and group selectors with ara-* variants. This would enable more granular and dynamic styling based on ARIA attributes. Here's an example:

<button data-accordion-trigger aria-label="toggle button"
    class="... group" ...>
    Can it be animated?
    <span
        class=".... group-aria-expanded-rotate-180"></span>
</button>

Currently, to accomplish the same effect, I have to write code like this:

<button data-accordion-trigger aria-label="toggle button"
    class="... [&[aria-expanded=true]>span]-rotate-180" ...>
    Can it be animated?
    <span data-trigger-icon
        class="ease-linear duration-300 ..."></span>
</button>

This would enable flexible and accessible styling for components based on changes in aria attribute states. It would enhance the maintainability and reusability of components by separating styling logic from component logic like in the given example.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the README.md of using the package.
  • Already used the Interactive Docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@Johnkat-Mj Johnkat-Mj changed the title Add support for peer and group variants on ara-* variants Add support for peer and group variants on aria-* variants Apr 5, 2024
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

1 participant