vue-search-select icon indicating copy to clipboard operation
vue-search-select copied to clipboard

Bug with keydown.esc

Open tleish opened this issue 5 years ago • 0 comments

I noticed a bug when entering a search and the pressing the "ESC" key. The menu closes as expected, but the cursor remains in the input field along with the prior search text. With the focus still in the input, if you start typing more the menu no longer appears. I can reproduce the bug on the example at https://vue-search-select.netlify.com/.

User workarounds:

  • Click outside control (resets control and menu)
  • Or click the backspace multiple times until the control resets.

Developer Workaround

You can place the following in the parent component (assuming you assigned ref="mySelect" on the component.

  mounted(){
      this.$watch(() => this.$refs.mySelect.showMenu, (value) => {
        if(value === false){
          this.$refs.mySelect.$refs.input.blur();
        }
      })
    }

Possible Component Fix:

// src/lib/common.js

  closeOptions (self) {
+   self.$refs.input.blur()
    self.showMenu = false
  },

tleish avatar Jan 23 '20 19:01 tleish