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
Document the disabled prop for Button #16531
Conversation
@@ -124,6 +124,7 @@ The presence of a `href` prop determines whether an `anchor` element is rendered | |||
|
|||
Name | Type | Default | Description | |||
--- | --- | --- | --- | |||
`disabled` | `bool` | `false` | Whether the button is disabled. |
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.
Hi @rmccue, thank you for your contribution 👍
Our code does not explicitly handle the disable property it ends up being supported because the props not documented here are passed as attributes to the "a" or "button" elements. Any HTML attribute supported by these elements will work.
Our documentation does not make that clear. What if we follow the same logic applied in: https://github.com/WordPress/gutenberg//blob/f6f7375d8dfa9ef52ef784e5e486c71656421770/packages/components/src/textarea-control/README.md#L98
We explicitly document:
Props not included in this set will be applied to the a
or button
elements.
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.
We should add that text as well, but Button does actually have specific handling for disabled
: if disabled
is specified, it overrides the tag type. I can document both if you'd like.
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.
I went ahead and updated it for that :)
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.
I'm sorry @rmccue, I missed that in this case disabled was used. The changes look good to me 👍 Thank you for the improvements.
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.
Makes sense to me!
I noticed
Button
is missing documentation for thedisabled
prop, which is actually supported.