GUI text input with Opera browser

I use the Opera browser and with GUI text inputs when I type numbers in with some numbers it switches tabs and other numbers it zooms in or out. Is there any way to prevent this from happening or is this a bug?

Here is a playground, it does not happen in any other browser.

I added this to the input and it seems to fix the issue

input.onKeyboardEventProcessedObservable.add((evt) => {

    evt.preventDefault();

});

Hi @Trevor_Orr,

Looks like you found the root cause! The InputText control calls preventDefault() on some special key combinations but not on printable characters like numbers and letters. Opera (and Chrome) uses Ctrl+number shortcuts for tab switching and zoom, so when you hold Ctrl and press a number while the input has focus, the keystroke is consumed by both the GUI input and the browser.

We’ve added preventDefault() for printable characters when the input actually consumes the keystroke, which prevents the browser from also acting on it. Your workaround with onKeyboardEventProcessedObservable works great in the meantime.

A fix is on the way, thanks for reporting this!

That is the curious part though I was not press the Ctrl key while entering in numbers.

I wasn’t able to repro without CTRL held down - can you double check? I know this may sound funny, but I’ve had CTRL stick on my keyboard multiple times in the past (had to press both repeatedly to get it back to a good state). Any chance that happened to you?

I have another keyboard around somewhere I will give it a try

I tried another keyboard and it does the same thing

Thanks for double checking - so when you run that playground in Opera, you click in the text box, then press a number like 2, and it switches to tab 2? I want to make sure I can repro the same thing so I ensure this is the right fix. I appreciate your help!

Yes, that is correct. It happens only in Opera. I tried it in Chrome, Edge, Firefox and Brave with both keyboards.

I just tried again in a fresh install of Opera and I opened 5 tabs, then opened Babylon.js Playground and tried typing 12345 in the text box and it didn’t switch tabs. Is it possible you have an extension installed that’s changing the behavior?

Well crap, I tried it in an incognito window and it does not do it. So it must be an extension. I will disable them one by one to track down the culprit.

Weird, I disabled all extensions, restarted Opera and it still does the same thing. Guess the issue is on my end somewhere.

That is odd! I think the fix is still worthwhile though, so it has been merged. Thanks for reporting this!