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 { table {
caption {
@include element-invisible;
}
thead { thead {
&, &,

View File

@@ -1,5 +1,6 @@
<% if phases.present? %> <% 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> <thead>
<tr> <tr>
<th><%= t("admin.budgets.edit.phase") %></th> <th><%= t("admin.budgets.edit.phase") %></th>

View File

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

View File

@@ -94,6 +94,7 @@ es:
publish: "Publicar presupuesto" publish: "Publicar presupuesto"
delete: Eliminar presupuesto delete: Eliminar presupuesto
phase: Fase phase: Fase
phases_caption: "Fases"
dates: Fechas dates: Fechas
enabled: Habilitada enabled: Habilitada
actions: Acciones 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_select "Phase", selected: "Selecting projects"
expect(page).to have_table "budget-phases-table", with_cols: [ expect(page).to have_table "Phases", with_cols: [
[ [
"Information", "Information",
"Accepting projects", "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 within "tr", text: "Information" do
expect(page).to have_css ".budget-phase-enabled.enabled" expect(page).to have_css ".budget-phase-enabled.enabled"
expect(page).to have_link "Edit phase" expect(page).to have_link "Edit phase"