talkhabi/vue-persian-datetime-picker

[Enhancement] keyCode in keydown event

raminjafary opened this issue · 1 comments

I think it is better to set the keyCode in keydown to 27 so one can close it with Escape key as it is more of a convention. This is what it looks like right now:

mounted () {

  /* --- snip --- */

document.body.addEventListener('keydown', e => {
      e = e || event
      if (e.keyCode === 9 && this.visible) this.visible = false
    })
}

As an enhancement we can make this a configurable option. I may open a PR, of course, if you do concur.

Thank you @raminjafary Ill add the 27 too, 9 is for tab key