Use a caption to identify budget phases table

This makes the table easier to identify when writing tests and using
screen readers.

Since we do not render any other table captions anywhere else, we're
making the caption invisible so only screen reader users will be
affected by this change.
This commit is contained in:
Javi Martín
2021-03-07 16:50:35 +01:00
parent 150fb91686
commit a2a6ae7bdd
5 changed files with 10 additions and 3 deletions

View File

@@ -212,6 +212,10 @@ $table-header: #ecf1f6;
table {
caption {
@include element-invisible;
}
thead {
&,

View File

@@ -1,5 +1,6 @@
<% if phases.present? %>
<table id="budget-phases-table" class="budget-phases-table table-for-mobile">
<table class="budget-phases-table table-for-mobile">
<caption><%= t("admin.budgets.edit.phases_caption") %></caption>
<thead>
<tr>
<th><%= t("admin.budgets.edit.phase") %></th>

View File

@@ -94,6 +94,7 @@ en:
publish: "Publish budget"
delete: Delete budget
phase: Phase
phases_caption: "Phases"
dates: Dates
enabled: Enabled
actions: Actions

View File

@@ -94,6 +94,7 @@ es:
publish: "Publicar presupuesto"
delete: Eliminar presupuesto
phase: Fase
phases_caption: "Fases"
dates: Fechas
enabled: Habilitada
actions: Acciones

View File

@@ -255,7 +255,7 @@ describe "Admin budgets", :admin do
expect(page).to have_select "Phase", selected: "Selecting projects"
expect(page).to have_table "budget-phases-table", with_cols: [
expect(page).to have_table "Phases", with_cols: [
[
"Information",
"Accepting projects",
@@ -278,7 +278,7 @@ describe "Admin budgets", :admin do
]
]
within_table "budget-phases-table" do
within_table "Phases" do
within "tr", text: "Information" do
expect(page).to have_css ".budget-phase-enabled.enabled"
expect(page).to have_link "Edit phase"