Skip to content

[v4.5] [Admin] Fix Unclosed form_tag in table component#6182

Merged
tvdeyen merged 1 commit intov4.5from
backport/v4.5/pr-6172
Mar 6, 2025
Merged

[v4.5] [Admin] Fix Unclosed form_tag in table component#6182
tvdeyen merged 1 commit intov4.5from
backport/v4.5/pr-6172

Conversation

@tvdeyen
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen commented Mar 6, 2025

Backport

This will backport the following commits from main to v4.5:

Questions ?

Please refer to the Backport tool documentation

This PR fixes an HTML structure break caused by an unclosed form_tag, ensuring that forms added after using ui/table are rendered correctly.

## Background

While customizing the index page to add a new form, I encountered a problem where the added form was not displayed in the browser. Upon investigation, I discovered that the issue stemmed from the form_tag in ui/table/component.html.erb not being explicitly closed, which resulted in subsequent form tags disappearing.

``` rb
<%= render component("ui/table/toolbar").new("data-#{stimulus_id}-target": "batchToolbar", role: "toolbar", "aria-label": t(".batch_actions"), hidden: true) do %>
  <%= form_tag '', id: batch_actions_form_id %>
  <% @data.batch_actions.each do |batch_action| %>
    <%= render_batch_action_button(batch_action) %>
  <% end %>
<% end %>
```

Due to the lack of a proper block structure closing the form_tag, the HTML became malformed, and any form tags declared afterward were not rendered.

Updated the form_tag to use a block form, ensuring that the opening and closing tags are explicitly defined.

(cherry picked from commit 6949386)
@tvdeyen tvdeyen requested a review from a team as a code owner March 6, 2025 10:02
@tvdeyen tvdeyen added backport-v4.5 Backport this pull-request to v4.5 changelog:solidus_admin labels Mar 6, 2025
@tvdeyen tvdeyen merged commit 2bd7779 into v4.5 Mar 6, 2025
@tvdeyen tvdeyen deleted the backport/v4.5/pr-6172 branch March 6, 2025 10:02
@tvdeyen tvdeyen removed the backport-v4.5 Backport this pull-request to v4.5 label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants