Skip to content

Conversation

@nimmolo
Copy link

@nimmolo nimmolo commented Nov 19, 2025

Re: comment here @bradgessler noticed while reviewing another PR of mine that Superform's input method has an issue with its signature: input elements are void/self-closing HTML elements and should not accept blocks. This PR removes the & block parameter from:

  • Input component's view_template method
  • All HTML5 input convenience methods (text, email, password, hidden, number, date, time, file, etc.)

Changes

  • lib/superform/rails/components/input.rb: Removed & from view_template(&)view_template
  • lib/superform/rails/field.rb: Removed & from all 17 input convenience methods
  • Tests: Added 9 tests verifying that blocks are properly ignored and don't render content

Test Coverage

All 109 tests passing. New tests verify backwards compatibility - blocks can still be passed without errors, but content is correctly ignored.

@nimmolo
Copy link
Author

nimmolo commented Nov 26, 2025

Noticing that you can pass a block to a textarea input and superform will interpret it as the field's content. However, if i'm not mistaken, this PR doesn't affect textarea.

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