From f7bba2f7101e484ad8e2eea4279994fb67c2b78b Mon Sep 17 00:00:00 2001 From: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Date: Mon, 25 Jul 2022 08:21:18 +0100 Subject: [PATCH] CLDC-1389: Set default option on accessible autocomplete (#778) * Set default option on accessile autocomplete * Filter out select an option value when javascript --- app/frontend/controllers/accessible_autocomplete_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/controllers/accessible_autocomplete_controller.js b/app/frontend/controllers/accessible_autocomplete_controller.js index 812cd37d3..3e19c4c9e 100644 --- a/app/frontend/controllers/accessible_autocomplete_controller.js +++ b/app/frontend/controllers/accessible_autocomplete_controller.js @@ -6,7 +6,7 @@ import { enhanceOption, suggestion, sort } from '../modules/search' export default class extends Controller { connect () { const selectEl = this.element - const selectOptions = Array.from(selectEl.options) + const selectOptions = Array.from(selectEl.options).filter(function (option, index, arr) { return option.value !== '' }) const options = selectOptions.map((o) => enhanceOption(o)) const matches = /^(\w+)\[(\w+)\]$/.exec(selectEl.name)