Open MattPurland opened 1 year ago
I've figured out a workaround using the onKeyDown event:
onKeyDown: (e) => {
if(e.which == 13) {
e.target.value = e.target.value + "\r";
return false;
}
}
Hi @MattPurland,
This is already fixed in the 5.0.9-beta version.
Sorry, it looks like this still isn't working (I'm testing with 5.0.9-beta.32). Please see updated codepen
Updated workaround for those interested
if(e.which == 13) {
let value = e.target.value,
index = e.target.selectionStart;
e.target.value = value.slice(0, index) + "\r" + value.slice(index);
e.target.setSelectionRange(index + 1, index + 1);
return false;
}
Describe the bug Pressing the return or enter key in a textarea with regex types the word 'Enter'
Add a link to a codepen, jsfiddle or other example page which shows the problem https://codepen.io/MattPurland/pen/yLGEOoj
OS: Windows 10
Browser Chrome
Inputmask version 5.0.8