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

Document the disabled prop for Button #16531

Merged
merged 3 commits into from Jul 11, 2019

Conversation

rmccue
Copy link
Contributor

@rmccue rmccue commented Jul 11, 2019

I noticed Button is missing documentation for the disabled prop, which is actually supported.

@@ -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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 :)

Copy link
Member

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.

Copy link
Member

@chrisvanpatten chrisvanpatten left a 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!

@jorgefilipecosta jorgefilipecosta merged commit 924f895 into master Jul 11, 2019
@jorgefilipecosta jorgefilipecosta deleted the document-button-disabled-prop branch July 11, 2019 14:12
@youknowriad youknowriad added this to the Gutenberg 6.2 milestone Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants