Problem:
Is there a way to add a label to a views search form?
I'm trying to optimise my page for accessibility, and WAVE keeps telling me every search box (element with js-wpv-filter-trigger class) I have is missing a label. I tried to add a label to the shortcode, but this doesn't work (e.g.
<div class="search-cat"> <label>[wpml-string context="wpv-views"]Search in categories:[/wpml-string]</label> [wpv-control taxonomy="category" url_param="wpv-category" type="select" default_label="Any" taxonomy_orderby="term_group"] </div>
- the label value doesn't actually appear when you inspect the page).
Solution:
please try to use tag to wrap the Views shortcode, and test again, for example:
<div class="search-cat"> <label>[wpml-string context="wpv-views"]Search in categories:[/wpml-string] [wpv-control taxonomy="category" url_param="wpv-category" type="select" default_label="Any" taxonomy_orderby="term_group"]</label> </div>
Relevant Documentation:
https://www.w3.org/WAI/tutorials/forms/labels/#associating-labels-implicitly
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
This topic contains 7 replies, has 3 voices.
Last updated by 6 years, 8 months ago.
Assisted by: Luo Yang.
The forum ‘Types Community Support’ is closed to new topics and replies.