Browse Source

Don't progressively enhance select options multiple times

pull/183/head
baarkerlounger 3 years ago
parent
commit
d655b6872d
  1. 10
      app/webpacker/controllers/accessible_autocomplete_controller.js

10
app/webpacker/controllers/accessible_autocomplete_controller.js

@ -4,9 +4,11 @@ import 'accessible-autocomplete/dist/accessible-autocomplete.min.css'
export default class extends Controller {
connect() {
accessibleAutocomplete.enhanceSelectElement({
defaultValue: '',
selectElement: this.element
})
if(document.querySelectorAll(".autocomplete__input").length == 0){
accessibleAutocomplete.enhanceSelectElement({
defaultValue: '',
selectElement: this.element
})
}
}
}

Loading…
Cancel
Save