Commit 3560dfb4 authored by mikemadison's avatar mikemadison Committed by borisson_

Issue #2992379 by mikemadison, mgifford, borisson_: Accessibility Issues with Certain Widgets

parent cc74e070
.facets-widget-dropdown label {
display: none;
}
......@@ -36,6 +36,12 @@ drupal.facets.hierarchical:
theme:
css/hierarchical.css: {}
drupal.facets.general:
version: VERSION
css:
theme:
css/general.css: {}
drupal.facets.dropdown-widget:
version: VERSION
js:
......
......@@ -41,7 +41,10 @@
$dropdown.addClass('js-facets-dropdown');
var id = $(this).data('drupal-facet-id');
// Add aria-labelledby attribute to reference label.
$dropdown.attr('aria-labelledby', "facet_"+id+"_label");
var default_option_label = settings.facets.dropdown_widget[id]['facet-default-option-label'];
// Add empty text option first.
var $default_option = $('<option />')
.attr('value', '')
......
......@@ -34,6 +34,7 @@ class DropdownWidget extends WidgetPluginBase {
$build['#attributes']['class'][] = 'js-facets-dropdown-links';
$build['#attached']['drupalSettings']['facets']['dropdown_widget'][$facet->id()]['facet-default-option-label'] = $this->getConfiguration()['default_option_label'];
$build['#attached']['library'][] = 'facets/drupal.facets.dropdown-widget';
$build['#attached']['library'][] = 'facets/drupal.facets.general';
return $build;
}
......
......@@ -43,4 +43,8 @@
{{- empty -}}
{%- endif -%}
{%- endif %}
{% if facet.widget.type == "dropdown" %}
<label id="facet_{{ facet.id }}_label">Facet {{ facet.label }}</label>
{%- endif %}
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment