Add autocomplete to button JSX type #9522
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This makes it possible to write
<button autocomplete="off" disabled>Action</button>
without getting type errors in Astro components.The change extends the JSX type of
ButtonHTMLAttributes
to include the “nonstandard and Firefox-specific”autocomplete
. While nonstandard, for dynamic front-ends / forms it is often required to include it because of the way Firefox caches disabled-state. (E.g. this StackOverflow question and answer.)See documentation of the attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#autocomplete
Testing
No tests are added, this is a singular extra attribute to be defined in the JSX types.
Docs
No docs are added, this should have no effect on Astro usage outside of type-checked components.