input: submit content when leaving focus, not only when hitting enter or tab (esc still cancels)

This commit is contained in:
bordun 2021-02-06 11:23:25 +01:00
parent bd3c5b36d5
commit b7765cee7d
2 changed files with 2 additions and 4 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- input: prevent focus when selecting the widget for edition
- input: submit content when leaving focus, not only when hitting `enter` or `tab` (`esc` still cancels)
- midi
- display an error when the midi bridge process crashes and prevent further errors when attempting to send messages

View file

@ -43,7 +43,6 @@ class Input extends Canvas {
this.value = ''
this.stringValue = ''
this.focused = false
this.tabKeyBlur = false
this.validation = null
if (this.getProp('vertical')) this.widget.classList.add('vertical')
@ -57,8 +56,7 @@ class Input extends Canvas {
this.widget.addEventListener('focus', this.focus.bind(this))
this.input = html`<input class="no-keybinding"></input>`
this.input.addEventListener('blur', (e)=>{
this.blur(this.tabKeyBlur)
this.tabKeyBlur = false
this.blur(true)
})
var asYouType = this.getProp('asYouType')
@ -75,7 +73,6 @@ class Input extends Canvas {
this.input.addEventListener('keydown', (e)=>{
if (e.keyCode === 13) this.blur() // enter
else if (e.keyCode === 27) this.blur(false) // esc
else if (e.keyCode === 9) this.tabKeyBlur = true // tab
else if (asYouType) {
setTimeout(()=>{
this.inputChange()