Hi,
I've encountered a small bug in the global search box related to the keyboard events. Atom (and this is version 2.4.1) is listening for the keyboard key codes (up and down), to traverse the suggestions box list. The problem is that it's using "keyup" and "keypress" events. While "keyup" and "keydown" would be fine to get the event key codes, the "keypress" event returns the corresponding char code, not the key code. This means that, at least for me, and particularly in Chrome, there are a coincidental match between the keycode for the up keyboard key (38) and the & symbol char code (38); so, typing the & symbol not only behaves like pressing the up arrow key in the keyboard, but also isn't typed in the box.
The problem is, apparently, limited to the global search box (I didn't really dig in to why is that), and I traced it down to js/dominion.js.
To temporarily solve the problem, there are two ways to (easily) do this:
1 - Just comment out the line 251 on js/dominion.js:
.on('keypress', $.proxy(this.keypress, this))
2 - Remove all keypress event listeners, by adding a piece of js code in the template:
window.addEventListener('keypress', function (event) {
event.stopPropagation();
}, true);
I ended up using option 2, in the _header.php file of my template, to avoid having to change js/dominion.js in the next Atom iteration; there seems to be no other consequences, by I'll be monitoring.
My question, after the long introduction: is there other, cleaner way, to do this? Can I override js/dominion,js in my template, or just remove the event listener of a specific object?
Thanks!
Alberto