Defect #43268
closedLabels not displayed for form.text_area fields in Redmine with Rails 8
0%
Description
When using the latest Redmine (Rails 8), the labels for Summary and Description are not displayed on the “Create News” page, even though the Title label appears as expected.
Steps to Reproduce:- Use the latest Redmine running on Rails 8.
- Open the New News creation page
- Observe that the Title label is visible, but Summary and Description labels are missing.
Expected | Result |
---|---|
![]() |
![]() |
Redmine overrides methods in app/lib/redmine/views/labelled_form_builder.rb so that a label is automatically added when using field helpers( https://github.com/redmine/redmine/blob/b84fe00f9daeea6d0f43bb1127444a94034ff403/lib/redmine/views/labelled_form_builder.rb#L25-L32 ), without explicitly adding a <label> tag.
However, a recent change in Rails 8 replaced textarea with text_area in field_helpers
(see rails/rails#52467 ).
Because Redmine currently expects textarea to be present, form.text_area no longer triggers automatic label generation.
Files
Related issues
Updated by Mizuki ISHIKAWA 1 day ago
This issue also causes system tests to fail.
It has been reported in #43205#note-8.
Error: InlineAutocompleteSystemTest#test_inline_autocomplete_on_news_description_should_show_autocomplete: Capybara::ElementNotFound: Unable to find field "Description" that is not disabled test/system/inline_autocomplete_test.rb:128:in 'InlineAutocompleteSystemTest#test_inline_autocomplete_on_news_description_should_show_autocomplete' bin/rails test test/system/inline_autocomplete_test.rb:120 ...............................................................[Screenshot Image]: /home/runner/work/redmine/redmine/tmp/screenshots/failures_test_application_creation_and_authorization.png E Error: OauthProviderSystemTest#test_application_creation_and_authorization: Capybara::ElementNotFound: Unable to find field "Redirect URI" that is not disabled test/system/oauth_provider_test.rb:25:in 'block (2 levels) in <class:OauthProviderSystemTest>' test/test_helper.rb:109:in 'ActiveSupport::TestCase#with_settings' test/system/oauth_provider_test.rb:15:in 'block in <class:OauthProviderSystemTest>' bin/rails test test/system/oauth_provider_test.rb:9
Updated by Mizuki ISHIKAWA 1 day ago
Here are two ideas for resolving the issue:
1. Add :textarea as a target to override in labelled_form_builder.rb.
diff --git a/lib/redmine/views/labelled_form_builder.rb b/lib/redmine/views/labelled_form_builder.rb
index f364ca8e2..b5b08200a 100644
--- a/lib/redmine/views/labelled_form_builder.rb
+++ b/lib/redmine/views/labelled_form_builder.rb
@@ -23,7 +23,7 @@ class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
include Redmine::I18n
(field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box label) +
- %w(date_select)).each do |selector|
+ %w(date_select text_area)).each do |selector|
src = <<-END_SRC
def #{selector}(field, options = {})
label_for_field(field, options) + super(field, options.except(:label)).html_safe
2. Use only f.text_area and discontinue the use of f.textarea.
Updated by Mizuki ISHIKAWA 1 day ago
I made a mistake in my writing #note-2.
The correct version is: 2. Use only f.textarea and discontinue the use of f.text_area.
Updated by Marius BĂLTEANU 1 day ago
- Related to Feature #43205: Update to Rails 8 added
Updated by Marius BĂLTEANU about 24 hours ago
- Category set to Rails support
- Status changed from New to Closed
- Assignee set to Marius BĂLTEANU
To fix the tests I've committed the fix from the second note. Also, I've created #43276 in order to drop the using of form.text_area. Being a major version, we can have this kind of changes.