select

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

commit
31286ad659a35a73341a850a01cc11c16519ef9a
parent
7c147bb206e4522c9feb095db3d3d239c80990ba
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-05-28 11:16
perf: use indexMap instead of query

Diffstat

M select.js 3 +--

1 files changed, 1 insertions, 2 deletions


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

@@ -173,10 +173,9 @@ export class Select {
  173   173 	}
  174   174 
  175   175 	moveFocus(k) {
  176    -1 		var options = this.dropdown.querySelectorAll('[role="option"]');
  177   176 		this.focus += k;
  178   177 		this.focus = Math.max(this.focus, 0);
  179    -1 		this.focus = Math.min(this.focus, options.length - 1);
   -1   178 		this.focus = Math.min(this.focus, this.indexMap.length - 1);
  180   179 		this.update();
  181   180 	}
  182   181