select

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

commit
3aa82e9d2f8488df25bfb61844da86e3ae2ab674
parent
7146d21376a81eabb31da1b13695bba340e23799
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-03-25 15:07
Revert "validate temporary value"

This reverts commit 497e43296f872fc16ebb8f80cccd7c18ced29ffb.

Diffstat

M select.js 12 +-----------

1 files changed, 1 insertions, 11 deletions


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

@@ -154,14 +154,6 @@ class Select {
  154   154 		this.updateValue();
  155   155 	}
  156   156 
  157    -1 	hasTemporaryValue() {
  158    -1 		if (this.original.multiple) {
  159    -1 			return this.input.value;
  160    -1 		} else {
  161    -1 			return this.input.value !== this.original.selectedOptions[0].label;
  162    -1 		}
  163    -1 	}
  164    -1 
  165   157 	onkeydown(event) {
  166   158 		if (this.focus !== -1) {
  167   159 			if (event.keyCode === KEYS.DOWN) {
@@ -215,9 +207,7 @@ class Select {
  215   207 			if (this.indexMap.length) {
  216   208 				this.setValue(this.indexMap[this.focus]);
  217   209 			}
  218    -1 			if (this.hasTemporaryValue()) {
  219    -1 				this.input.setCustomValidity('temporary value');
  220    -1 			} else if (!this.original.checkValidity()) {
   -1   210 			if (!this.original.checkValidity()) {
  221   211 				this.input.setCustomValidity(this.original.validationMessage);
  222   212 			}
  223   213 			this.close();