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

Add autocomplete to button JSX type #9522

Merged
merged 2 commits into from
Dec 25, 2023
Merged

Conversation

Zegnat
Copy link
Contributor

@Zegnat Zegnat commented Dec 25, 2023

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.

This is “nonstandard and Firefox-specific” but often required when working with dynamic disabled state.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#autocomplete
Copy link

changeset-bot bot commented Dec 25, 2023

🦋 Changeset detected

Latest commit: 05113bd

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Dec 25, 2023
Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sucks that it's required, but fine by me!

@Princesseuh Princesseuh merged commit bb1438d into withastro:main Dec 25, 2023
13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Dec 25, 2023
akshit20421 added a commit to akshit20421/astro that referenced this pull request Dec 25, 2023
Add autocomplete to button JSX type (withastro#9522)
@Zegnat Zegnat deleted the Zegnat-patch-1 branch December 25, 2023 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants