Last modified: 2014-10-10 20:39:13 UTC
For some reason, the 'keydown' event is being unbound when the suggestions popup appears, so the function is never firing. However, it seems like they shouldn't be listening to keydown anyway because they only care about when the enter key is pressed and that event is already available on the input as the 'enter' event (from OO.ui.TextInputWidget). With love from the Wikia development team.
<Krenair> Krinkle, http://imgur.com/a39IuMk - that's handlers, handlers.length, handleObj <Krenair> Immediately after handlers.push( handleObj ); in jquery.event.add handlers.push( handleObj ); if ( types.indexOf( 'keydown' ) !== -1 ) { console.log( handlers ); console.log( handlers.length ); console.log( handleObj ); }
Created attachment 16743 [details] Screenshot of bug not happening. I can't reproduce this. When typing in the input, I see all keydowns happening as they should. From the key codes in the screenshot: * [shift] * E * x * a * m * p * l * e * [enter]
The handler from MWCategoryWidget is working fine. However, here is the code I used for comment #2 In ve/ui/MWCategoryWidget.js: this.input.$input.on( 'keypress', function () { console.log( ['MWCategoryWidget', 'MWCategoryInputWidget', '$input', 'keypress'] ); } ); this.input.on( 'enter', function () { console.log( ['MWCategoryWidget', 'MWCategoryInputWidget', 'enter'] ); } ); And the 'enter' event never fired. Because there is still a mystery here. The event bound by OO.ui.TextInputWidget on $input for 'keypress' (which fires 'enter') disappears somehow. Putting the same logger in there makes it never fire.
Nevermind. They all work fine now. There is still a tech debt here though, we should use OOjs UI's "enter" event (instead of manually binding keypress and looking for keyCode=13), but it works fine.
(In reply to Krinkle from comment #4) > There is still a tech debt here though, we should use OOjs UI's "enter" event > (instead of manually binding keypress Done in Ia47bc8976f22dfe7e3a6fb6068dc4b6e03a3357b.