Skip to content

Conversation

@pierry01
Copy link
Contributor

@pierry01 pierry01 commented May 7, 2025

Based on these articles from
developer.mozilla.org | kittygiraudel.com | dhiwise.com | a11y-101.com | dev.to

It's necessary to provide the support for users who want to use aria-disabled instead of disable

Comment on lines +39 to +43
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors bg-primary text-primary-foreground shadow",
"hover:bg-primary/90",
"disabled:pointer-events-none disabled:opacity-50",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
"aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-not-allowed",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be a good practice to separate the main classes from the pseudo classes triggers
it's more readable and maintainable

@stephannv stephannv merged commit 848230d into ruby-ui:main May 7, 2025
2 checks passed
"hover:underline",
"disabled:pointer-events-none disabled:opacity-50",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
"aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-not-allowed",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code responsible for style de disable look and feel is getting repetead all over the different variants.

It would be nice to define a private constant to define the code and add it here. Something like:

DISABLED_CLASSES = [
"disabled:pointer-events-none disabled:opacity-50",
"aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-not-allowed"
]
    def primary_classes
      [
        "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors bg-primary text-primary-foreground shadow",
        "hover:bg-primary/90",
         size_classes,
         DISABLED_CLASSES

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.

3 participants