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 button_classes to CoreComponents #6089

Merged
merged 2 commits into from
Feb 18, 2025
Merged

add button_classes to CoreComponents #6089

merged 2 commits into from
Feb 18, 2025

Conversation

SteffenDE
Copy link
Contributor

@SteffenDE SteffenDE commented Feb 17, 2025

Buttons and Links must not be nested inside each other, otherwise there are accessibility issues. A previous PR did not fix the problem, but just inverted the problem.

Adds a helper function to return button_classes for styling other components, like links.

Fixes #5770.
Relates to: #5820

Buttons and Links must not be nested inside each other, otherwise there
are accessibility issues. A previous PR did not fix the problem, but just
inverted the problem.

Adds a link that is styled like a button.

Fixes #5770.
Relates to: #5820
@SteffenDE SteffenDE requested a review from josevalim February 18, 2025 09:39
@josevalim
Copy link
Member

I would personally prefer to avoid new function components. I wonder if we could instead have a function called button_classes() that we use in our button component and elsewhere?

@SteffenDE
Copy link
Contributor Author

Like this?

<.link class={button_classes()} href={~p"<%= schema.route_prefix %>/new"}>
    New <%= schema.human_singular %>
</.link>

Maybe feels weird to have a non-component function imported, but I guess it's fine.

@josevalim
Copy link
Member

Yes, exactly. If we can share that across places, then it looks good to me! We may need appearance-none.

@SteffenDE
Copy link
Contributor Author

Changed! I don't think we need appearance-none there, but people may add it if they use it in weird places 😃

@SteffenDE SteffenDE changed the title add new link_button core component add button_classes to CoreComponents Feb 18, 2025
Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

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

!!!!!

@SteffenDE SteffenDE merged commit d87d36b into main Feb 18, 2025
10 checks passed
@SteffenDE SteffenDE deleted the sd-link-button branch February 18, 2025 14:51
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.

HTML and Live CRUD generators output invalid HTML (buttons nested in links)
2 participants