Skip to content

Commit

Permalink
Fix select a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
francescozaia committed Jun 17, 2019
1 parent decfca2 commit c2d254a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/assets/src/js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $(function () {

// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
var btnHtml = '<div class="bd-clipboard"><button class="btn-clipboard" title="Copy to clipboard">Copy</button></div>'
var btnHtml = '<div class="bd-clipboard"><button class="btn-clipboard" title="Copy to clipboard">Copia</button></div>'
$(this).before(btnHtml)
$('.btn-clipboard')
.tooltip()
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/src/scss/_clipboard-js.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
display: block;
padding: .25rem .5rem;
font-size: 75%;
color: #818a91;
color: #F2F2F5;
cursor: pointer;
background-color: transparent;
border: 0;
Expand Down
4 changes: 2 additions & 2 deletions docs/form/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Per inserire il componente [Checkbox]({{ site.baseurl }}/docs/form/checkbox/) in

Dal momento che il plugin viene attivato al caricamento del documento mentre a volte può essere necessario attendere, viene messa a disposizione una funzione `$.setOptionsToSelect(_parametro)` che permette di riscrivere le opzioni della select, ad esempio nel caso vengano caricate successivamente. La funzione dev'essere chiamata dall'elemento con classe `.bootstrap-select-wrapper`, e con parametro in input `_parametro` un oggetto Javascript con proprietà "value" e "text" come segue:

```
{% highlight js %}
$(document).ready(function() {
$('.bootstrap-select-wrapper.my-select-wrapper').setOptionsToSelect([{
text: 'push Label 1',
Expand All @@ -202,5 +202,5 @@ $(document).ready(function() {
value: 'pushValue 3'
}]);
});
```
{% endhighlight %}

4 changes: 4 additions & 0 deletions src/js/plugins/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,21 @@ $(function() {
.find('button.dropdown-toggle')
.removeAttr('role')
// Replace any <div>s elements with <span>s as <div>s are not allowed in a button element
$selectWrapper
.find('div.filter-option')
.replaceWith(function() {
return $('<span />')
.addClass('filter-option')
.append($(this).contents())
})
$selectWrapper
.find('div.filter-option-inner')
.replaceWith(function() {
return $('<span />')
.addClass('filter-option-inner')
.append($(this).contents())
})
$selectWrapper
.find('div.filter-option-inner-inner')
.replaceWith(function() {
return $('<span />')
Expand All @@ -77,6 +80,7 @@ $(function() {
$selectWrapper
.find('.dropdown-menu')
.attr('aria-expanded', 'false')
$selectWrapper
// Enter a title in the input search
.find('.bs-searchbox input')
.attr('title', 'Cerca')
Expand Down

0 comments on commit c2d254a

Please sign in to comment.