vue-masked-input icon indicating copy to clipboard operation
vue-masked-input copied to clipboard

Tab key not working to move focus

Open andreladocruz opened this issue 7 years ago • 5 comments

andreladocruz avatar Nov 11 '17 16:11 andreladocruz

Try to add this line in maskedinput.js

mouseup: this.mouseUp,
focusin: this.mouseUp, // line to add
focusout: this.focusOut,

Ex10Dios avatar Nov 14 '17 06:11 Ex10Dios

@Ex10Dios, thanks!!!

I'm running it in a Laravel installation.

I edited both files (in dist and src directories) and compiled again with NPM.

But still the same issue.

Any clue about what I'm doing wrong?

andreladocruz avatar Nov 15 '17 19:11 andreladocruz

This appears to be an issue with Firefox only. I'm experiencing this with FF v59.0.1 on both Mac and PC.

gml-fahlgren avatar Mar 20 '18 17:03 gml-fahlgren

Similar issue to @gml-fahlgren - seems to only affect Firefox.

Edit: Further debugging shows that the tab keyCode check is actually reached in FF

keyUp: function keyUp(e) {
  console.log('KeyCode in keyUp', e.keyCode);
  if (e.keyCode === 9) {
    console.log('Tab pressed!');
    // Prevent change selection for Tab in
    return;
  }
  this.updateToCoreState();
  this.updateAfterAll = false;
}

so I'm wondering if either we're returning the wrong value or the event doesn't bubble up properly? 🤔

andreasvirkus avatar Apr 27 '18 06:04 andreasvirkus

@gml-fahlgren I've managed to find a fix, it's actually in the firefox/IE check in keydown listener:

if (isIE || isFirefox) {
  e.preventDefault();
  e.data = e.key;
  this.textInput(e);
}

And the temporary fix (although I think it could be handled more elegantly, since a lot of other key modifiers are still blocked atm like browser tab shortcuts [Alt+N]):

if ((isIE || isFirefox) && e.keyCode !== 9) {
  e.preventDefault();
  e.data = e.key;
  this.textInput(e);
}

I'm planning to fork the repo soon. I'd first want to do some clean up on the code. I'll post the new repo link then under https://github.com/niksmr/vue-masked-input/issues/42

andreasvirkus avatar Apr 27 '18 11:04 andreasvirkus