Open viteksafronov opened 10 years ago
That's a well-known bug. Opera mobile completely ignores preventDefault/return false for keydown and keypress events. There is a simple example which illustrates that behaviour: http://jsfiddle.net/5zrhutra/ Opera mobile is an outdated browser and it won't be updated anymore. Personally, I came to a decision just not to add formatter for opera:
var isOperaMobile = navigator.userAgent.toLowerCase().indexOf('opera mobi/') !== -1;
if (!isOperaMobile) {
new Formatter(...);
}
All these bugs can be reproduced in Opera Mobile Emulator http://www.opera.com/ru/developer/mobile-emulator
Unfortunately I do not see a solution if preventDefault
is ignored. The library depends on this functionality. Perhaps an error or warning should be thrown when using an unsupported browser.
Browser sniffing is an ugly solution, but with so many inconsistencies in browser keyboard handling, it may be the best solution.
I have a classic pattern for credit cards pattern: '{{9999}} {{9999}} {{9999}} {{9999}} {{99}}' When I try to enter the number in Opera Mobile, every digit is entered twice, so I have to delete an extra char.