Files
grecia/app/views/admin/dashboard/actions/_form.html.erb
Javi Martín 932d4cd698 Fix wrong ARIA attribute in dashboard actions form
Using a `data-toggle` attribute, which we do since commit 07fd5084f,
made Foundation generate an `aria-expanded` attribute to a radio button,
but this attribute can't be present in radio buttons. This makes sense,
since the main purpose of a radio button in a form is to choose an
option, not to show/hide content.

This resulted in the following error when checking the page with Axe:

```
Found 1 accessibility violation:

aria-allowed-attr: Elements must only use supported ARIA attributes
(critical)
https://dequeuniversity.com/rules/axe/4.10/aria-allowed-attr?application=axeAPI
The following 2 nodes violate this rule:

  Selector: #dashboard_action_action_type_proposed_action
  HTML: <input data-toggle="request_to_administrators short_description"
               type="radio" value="proposed_action" checked="checked"
               name="dashboard_action[action_type]"
               id="dashboard_action_action_type_proposed_action"
               aria-expanded="true"
               aria-controls="request_to_administrators">
  Fix all of the following:
    - ARIA attribute is not allowed: aria-expanded="true"

  Selector: #dashboard_action_action_type_resource
  HTML: <input data-toggle="request_to_administrators short_description"
               type="radio" value="resource"
               name="dashboard_action[action_type]"
               id="dashboard_action_action_type_resource"
               aria-expanded="true"
               aria-controls="request_to_administrators">
  Fix all of the following:
    - ARIA attribute is not allowed: aria-expanded="true"
```

So we're using custom JavaScript instead. We're also making the
`short_description` field act as intended; since the changes in commit
07fd5084f it was never shown because it had the `hide` HTML class and it
didn't have a `data-toggler` attribute.
2025-04-02 13:43:29 +02:00

77 lines
2.2 KiB
Plaintext

<%= render "shared/errors" %>
<div class="row expanded">
<div class="small-12 medium-4 column">
<%= f.label :action_type %>
<% ::Dashboard::Action.action_types.keys.each do |action_type_value| %>
<span class="margin-right">
<%= f.radio_button :action_type, action_type_value %>
</span>
<% end %>
</div>
<div class="small-12 column margin-top">
<%= f.check_box :active %>
</div>
<div id="request_to_administrators" class="small-12 column margin-bottom">
<%= f.check_box :request_to_administrators %>
</div>
</div>
<div class="row expanded">
<div class="small-12 column">
<%= f.text_field :title %>
<div id="short_description">
<%= f.text_field :short_description %>
</div>
<%= f.text_area :description, class: "html-area" %>
</div>
</div>
<div class="row expanded margin-top">
<div class="small-12 column">
<%= f.check_box :published_proposal %>
<p class="help-text"><%= t("admin.dashboard.actions.form.published_proposal_help_text") %></p>
</div>
</div>
<div class="row expanded margin-top">
<div class="small-12 medium-4 column">
<%= f.number_field :day_offset, step: 1,
min: 0,
hint: t("admin.dashboard.actions.form.help_text") %>
</div>
<div class="small-12 medium-4 column">
<%= f.number_field :required_supports, step: 1,
min: 0,
hint: t("admin.dashboard.actions.form.help_text") %>
</div>
<div class="small-12 medium-4 column">
<%= f.number_field :order, step: 1,
min: 0,
hint: t("admin.dashboard.actions.form.help_text") %>
</div>
</div>
<% if feature?(:allow_attached_documents) %>
<div class="small-12 column">
<%= render Documents::NestedComponent.new(f) %>
</div>
<% end %>
<div class="links small-12 column">
<%= render "links/nested_links", linkable: dashboard_action, f: f %>
</div>
<div class="row expanded">
<div class="small-12 medium-6 large-4 column">
<%= f.submit(class: "button expanded", value: t("admin.dashboard.actions.form.submit_button")) %>
</div>
</div>