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

Make button_tag more helpful #189

Closed
wants to merge 2 commits into from
Closed

Make button_tag more helpful #189

wants to merge 2 commits into from

Conversation

tomstuart
Copy link
Contributor

The button_tag helper isn't very helpful at the moment for two reasons:

  • it defaults the type attribute to "button", which is unexpected since type="submit" is HTML's default for the <button> element; and
  • it doesn't take a block, but the main reason to use <button> (instead of <input type="submit"> et al) is that you want to include styled text or other elements like images.

These two commits fix the implementation, tests and docs for these two issues respectively.

"submit" is the default value of the <button> element's type attribute
according to the HTML 4.01 and the HTML5 draft specs, so if button_tag
is going to have a default, type="submit" is a more sensible choice than
type="button".

http://www.w3.org/TR/html401/interact/forms.html#adef-type-BUTTON
http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type
As per the HTML 4.01 spec:

  Buttons created with the BUTTON element function just like buttons
  created with the INPUT element, but they offer richer rendering
  possibilities: the BUTTON element may have content. For example, a
  BUTTON element that contains an image functions like and may resemble
  an INPUT element whose type is set to "image", but the BUTTON element
  type allows content.

Since rich content is the main purpose of the <button> element, it makes
sense for the button_tag helper to accept a block.

http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON
http://dev.w3.org/html5/spec/the-button-element.html#the-button-element
@spastorino
Copy link
Contributor

Pushed thanks.

matthewd pushed a commit that referenced this pull request Apr 24, 2018
This pull request was closed.
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.

2 participants