Skip to content

Commit

Permalink
Does not actually allow you to select
Browse files Browse the repository at this point in the history
You can use the arrow key to go to the first item in the list, but then every time you press it takes you back to the first item in the list
  • Loading branch information
maxkadel committed Jan 28, 2025
1 parent 2b51315 commit 524c156
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/javascript/orangelight/multiselect_combobox.es6
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@ export default class MultiselectCombobox {
this.listElement.querySelectorAll('li').forEach((item) => {
this.#addEventListener(item);
});
this.inputElement.addEventListener('input', (event) => {
this.inputElement.addEventListener('keyup', (event) => {
const isUpOrDownEvent = ['ArrowUp', 'ArrowDown'].includes(event.key);
const getToggleButton = event.target;
const instance = bootstrap.Dropdown.getOrCreateInstance(getToggleButton);
if (isUpOrDownEvent) {
event.stopPropagation();
instance.show();

instance._selectMenuItem(event);

return;
}
console.log(`I'm in the event listener for event: ${event}`);
});
this.inputElement.addEventListener('keyup', (event) => {
this.updateOptionVisibility();
this.#openDropdownIfClosed();
});
Expand Down

0 comments on commit 524c156

Please sign in to comment.