From 1b4dcee694bcd4c0c5dfd7749a50d15497d3821d Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 21 Aug 2025 15:35:44 -0500 Subject: [PATCH] Add combobox role --- app/javascript/controllers/navigable_list_controller.js | 6 ++---- app/views/cards/index/_header.html.erb | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/javascript/controllers/navigable_list_controller.js b/app/javascript/controllers/navigable_list_controller.js index e7af08134..a5aa1a94f 100644 --- a/app/javascript/controllers/navigable_list_controller.js +++ b/app/javascript/controllers/navigable_list_controller.js @@ -79,13 +79,11 @@ export default class extends Controller { this.#clearSelection() selectedItem.setAttribute(this.selectionAttributeValue, "true") this.currentItem = selectedItem - + await nextFrame() + if (this.focusOnSelectionValue) { this.currentItem.focus() } if (this.hasInputTarget && id) { this.inputTarget.setAttribute("aria-activedescendant", id) } - - await nextFrame() - if (this.focusOnSelectionValue) { this.currentItem.focus() } } } diff --git a/app/views/cards/index/_header.html.erb b/app/views/cards/index/_header.html.erb index 61fdc3bcd..b945bed15 100644 --- a/app/views/cards/index/_header.html.erb +++ b/app/views/cards/index/_header.html.erb @@ -30,7 +30,7 @@ navigable_list_actionable_items_value: true } do %>
<%= text_field_tag :search, nil, placeholder: "Filter…", class: "input input--transparent txt-small", autofocus: true, - type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", navigable_list_target: "input", action: "input->filter#filter" }, aria: { activedescendant: "filter-hotkey-1" } %> + type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", navigable_list_target: "input", action: "input->filter#filter" }, role: "combobox", aria: { activedescendant: "" } %>