-
Notifications
You must be signed in to change notification settings - Fork 10
feat(button): added possibility to set commandfor
and command
attributes
#4408
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?
feat(button): added possibility to set commandfor
and command
attributes
#4408
Conversation
The React types aren't ready for this feature. We need to add a custom Is there any community member asking for this feature? |
Pull request was converted to draft
React doesn't seem to react on this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for the HTML commandfor
and command
attributes to the button component, enabling implementation of command button functionality. These attributes allow buttons to control other interactive elements on the page.
- Added
commandfor
andcommand
properties to the button component type definitions - Updated the button component template to render the new attributes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
packages/components/src/components/button/model.ts | Added type definitions for commandfor and command properties with documentation |
packages/components/src/components/button/button.lite.tsx | Added rendering of commandfor and command attributes to the button element |
@@ -79,6 +79,16 @@ export type DBButtonDefaultProps = { | |||
* Variant of the button. Use only 1 primary button on a page as CTA otherwise use one of the adaptive buttons. | |||
*/ | |||
variant?: ButtonVariantType | string; | |||
|
|||
/** | |||
* Either standardized or custom actions to be performed on an element that is being controlled by a control <button>, specified via the commandfor attribute. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#commandfor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment appears to be incomplete or unclear. The phrase 'Either standardized or custom actions to be performed on an element that is being controlled by a control ' is confusing. Consider clarifying that this attribute specifies the ID of the element to be controlled.
* Either standardized or custom actions to be performed on an element that is being controlled by a control <button>, specified via the commandfor attribute. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#commandfor) | |
* Specifies the ID of the element to be controlled by the button. This attribute is used to associate the button with an interactive element that it controls. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#commandfor) |
Copilot uses AI. Check for mistakes.
commandfor?: string; | ||
|
||
/** | ||
* Turns a <button> HTML element into a command button, controlling the given interactive element; takes the ID of the element to control as its value. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation describes the command
attribute functionality, but based on the MDN link and HTML specification, this attribute description may be inaccurate. The command
attribute typically specifies the command to execute, not the ID of an element to control. Please verify the attribute behavior and update the documentation accordingly.
* Turns a <button> HTML element into a command button, controlling the given interactive element; takes the ID of the element to control as its value. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#command) | |
* Specifies a command to execute, typically used in <command> elements. Note that the `command` attribute is not standard for <button> elements and may not be widely supported. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/command) |
Copilot uses AI. Check for mistakes.
Proposed changes
Enables implementation of #3322
Types of changes
Further comments