select

Better select widgets in vanilla javascript.  https://p.ce9e.org/select/demo/
git clone https://git.ce9e.org/select.git

commit
2e58b0c814fa0b2ff30bc445dd92106d16f414a4
parent
8108db264c38a70f8c591f795709f2a5301674c7
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-09-02 17:30
valueFocusClass: replace completely

Diffstat

M values.js 6 +++---

1 files changed, 3 insertions, 3 deletions


diff --git a/values.js b/values.js

@@ -6,7 +6,7 @@ export class Values {
    6     6 		this.focus = 0;
    7     7 		this.input = input;
    8     8 		this.valueClass = valueClass || 'select__value';
    9    -1 		this.valueFocusClass = valueFocusClass || 'select__value--focus';
   -1     9 		this.valueFocusClass = valueFocusClass || `${this.valueClass} ${this.valueClass}--focus`;
   10    10 
   11    11 		this.el = create('<ul class="select__values" role="group">');
   12    12 		this.el.id = id;
@@ -29,7 +29,7 @@ export class Values {
   29    29 		if (k !== this.focus) {
   30    30 			if (this.focus !== 0) {
   31    31 				const el = this.el.children[n + this.focus];
   32    -1 				el.classList.remove(this.valueFocusClass);
   -1    32 				el.className = this.valueClass;
   33    33 				if (this.input.getAttribute('aria-activedescendant') === el.id) {
   34    34 					this.input.removeAttribute('aria-activedescendant');
   35    35 				}
@@ -37,7 +37,7 @@ export class Values {
   37    37 			this.focus = k;
   38    38 			if (this.focus !== 0) {
   39    39 				const el = this.el.children[n + this.focus];
   40    -1 				el.classList.add(this.valueFocusClass);
   -1    40 				el.className = this.valueFocusClass;
   41    41 				this.input.setAttribute('aria-activedescendant', el.id);
   42    42 			}
   43    43 		}