Skip to content

Commit 5469022

Browse files
Nyholmnicolas-grekas
authored andcommitted
[Form][WCAG] Added role=\"presentation\" on tables & removed bootstrap4 table
1 parent 74b93eb commit 5469022

File tree

3 files changed

+43
-27
lines changed

3 files changed

+43
-27
lines changed

Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,48 @@
5858
{%- else -%}
5959
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
6060
<div {{ block('widget_container_attributes') }}>
61-
<div class="table-responsive">
62-
<table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}">
63-
<thead>
64-
<tr>
65-
{%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%}
66-
{%- if with_months %}<th>{{ form_label(form.months) }}</th>{% endif -%}
67-
{%- if with_weeks %}<th>{{ form_label(form.weeks) }}</th>{% endif -%}
68-
{%- if with_days %}<th>{{ form_label(form.days) }}</th>{% endif -%}
69-
{%- if with_hours %}<th>{{ form_label(form.hours) }}</th>{% endif -%}
70-
{%- if with_minutes %}<th>{{ form_label(form.minutes) }}</th>{% endif -%}
71-
{%- if with_seconds %}<th>{{ form_label(form.seconds) }}</th>{% endif -%}
72-
</tr>
73-
</thead>
74-
<tbody>
75-
<tr>
76-
{%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%}
77-
{%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%}
78-
{%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%}
79-
{%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%}
80-
{%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%}
81-
{%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%}
82-
{%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%}
83-
</tr>
84-
</tbody>
85-
</table>
61+
{%- if with_years -%}
62+
<div class="col-auto">
63+
{{ form_label(form.years) }}
64+
{{ form_widget(form.years) }}
8665
</div>
66+
{%- endif -%}
67+
{%- if with_months -%}
68+
<div class="col-auto">
69+
{{ form_label(form.months) }}
70+
{{ form_widget(form.months) }}
71+
</div>
72+
{%- endif -%}
73+
{%- if with_weeks -%}
74+
<div class="col-auto">
75+
{{ form_label(form.weeks) }}
76+
{{ form_widget(form.weeks) }}
77+
</div>
78+
{%- endif -%}
79+
{%- if with_days -%}
80+
<div class="col-auto">
81+
{{ form_label(form.days) }}
82+
{{ form_widget(form.days) }}
83+
</div>
84+
{%- endif -%}
85+
{%- if with_hours -%}
86+
<div class="col-auto">
87+
{{ form_label(form.hours) }}
88+
{{ form_widget(form.hours) }}
89+
</div>
90+
{%- endif -%}
91+
{%- if with_minutes -%}
92+
<div class="col-auto">
93+
{{ form_label(form.minutes) }}
94+
{{ form_widget(form.minutes) }}
95+
</div>
96+
{%- endif -%}
97+
{%- if with_seconds -%}
98+
<div class="col-auto">
99+
{{ form_label(form.seconds) }}
100+
{{ form_widget(form.seconds) }}
101+
</div>
102+
{%- endif -%}
87103
{%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%}
88104
</div>
89105
{%- endif -%}

Resources/views/Form/bootstrap_base_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<div {{ block('widget_container_attributes') }}>
8989
{{- form_errors(form) -}}
9090
<div class="table-responsive">
91-
<table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}">
91+
<table class="table {{ table_class|default('table-bordered table-condensed table-striped') }}" role="presentation">
9292
<thead>
9393
<tr>
9494
{%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%}

Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
{%- else -%}
137137
<div {{ block('widget_container_attributes') }}>
138138
{{- form_errors(form) -}}
139-
<table class="{{ table_class|default('') }}">
139+
<table class="{{ table_class|default('') }}" role="presentation">
140140
<thead>
141141
<tr>
142142
{%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%}

0 commit comments

Comments
 (0)