rails: select tags and their hidden field counterparts are rendered in the wrong order

Currently if you render a select tag with the form helper you end up with a hidden field followed by the select tag. This is fine in most cases, but on older versions of IE, when you are wrapping said select tag with a label tag, the label will get associated with the hidden field rather than the select. Subtle, but it has caused us some usability bugs.

The culprit is here: https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tags/base.rb#L126

The solution is simply to swap the order of the + operands.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 21 (20 by maintainers)

Most upvoted comments

It seems we managed to take long enough that IE <= 8 is no longer worthy of concern. 😕

At this point, I think the danger of the DOM change outweighs the ancient-IE benefit.