Skip to content

Conversation

@inulty-dfe
Copy link

@inulty-dfe inulty-dfe commented Nov 14, 2025

Context

Form inputs accept a form attribute which allows you to place an input tag outside the block of a form tag and have that input value submitted with the form.

Reference

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form

The form attribute lets you place an input anywhere in the document but have it included with a form elsewhere in the document.

Approach

I tried to set the form attribute directly but it wasn't being rendered. Maybe someone can suggest why and I can avoid using the ref unnecessarily.

This is a known issue with Preact (and React). The form attribute is treated specially because HTMLInputElement.form is a read-only property that can't be set directly - it's automatically determined by the browser based on the input's parent form element.

@netlify
Copy link

netlify bot commented Nov 14, 2025

Deploy Preview for accessible-autocomplete ready!

Name Link
🔨 Latest commit 061dc8d
🔍 Latest deploy log https://app.netlify.com/projects/accessible-autocomplete/deploys/691c3f3bad4ff30008381ef5
😎 Deploy Preview https://deploy-preview-778--accessible-autocomplete.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@inulty-dfe inulty-dfe force-pushed the allow-explicit-form-property-on-input branch from 3ddc9f5 to 061dc8d Compare November 18, 2025 09:41
@inulty-dfe inulty-dfe marked this pull request as ready for review November 18, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant