-
Notifications
You must be signed in to change notification settings - Fork 307
fix: ensure button renders custom tag #1645
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
base: main
Are you sure you want to change the base?
fix: ensure button renders custom tag #1645
Conversation
@michelheusschen is attempting to deploy a commit to the Themesberg Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe updates refactor the button and radio button components to simplify their rendering logic, removing unnecessary manual event handling and redundant branches. Additionally, comprehensive test files are introduced for both button and radio button components, covering various rendering scenarios and user interactions using Svelte Testing Library and Vitest. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ButtonComponent
participant DOM
User->>ButtonComponent: Render with props (href, tag, etc.)
alt href is defined
ButtonComponent->>DOM: Render <a> element with props
else tag is "button" and href is undefined
ButtonComponent->>DOM: Render <button> element
else
ButtonComponent->>DOM: Render element specified by tag
end
sequenceDiagram
participant User
participant RadioButtonComponent
participant DOM
User->>RadioButtonComponent: Render with props (name, value, etc.)
RadioButtonComponent->>DOM: Render <label> containing <input type="radio">
User->>DOM: Click label or input
DOM->>RadioButtonComponent: Native event triggers input selection
RadioButtonComponent->>DOM: Updates checked state
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (9)
🔇 Additional comments (12)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Why do you want to use Button for label? Can't you use |
Are you suggesting that the CheckboxButton and RadioButton components should use the Label component instead? While that could work, it would result in duplicating a lot of the button component's code. I think it's better to fix root cause: the button component doesn't correctly use the tag prop. Which is exactly what this PR tries to accomplish. |
Closes #1644
📑 Description
Fixes an issue where the
Button
component doesn't use the custom tag. This also affects theCheckboxButton
andRadioButton
since they use<Button tag="label">
. These components produce invalid html as a result, according to the Nu Html Checker:Error: The element input must not appear as a descendant of the button element.
Other changes/fixes:
role="button"
from anchorStatus
✅ Checks
ℹ Additional Information
Summary by CodeRabbit
Bug Fixes
Tests