Last modified: 2014-10-10 20:39:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T58700, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56700 - VisualEditor: The handler MWCategoryWidget#onLookupInputKeyDown is not actually bound to anything
VisualEditor: The handler MWCategoryWidget#onLookupInputKeyDown is not actual...
Status: RESOLVED WORKSFORME
Product: VisualEditor
Classification: Unclassified
MediaWiki integration (Other open bugs)
unspecified
All All
: High minor
: ---
Assigned To: Krinkle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-07 00:03 UTC by Trevor (Wikia)
Modified: 2014-10-10 20:39 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Screenshot of bug not happening. (514.56 KB, image/png)
2014-10-10 19:59 UTC, Krinkle
Details

Description Trevor (Wikia) 2013-11-07 00:03:28 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.
Comment 1 Alex Monk 2014-07-07 19:54:34 UTC
<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 );
}
Comment 2 Krinkle 2014-10-10 19:59:28 UTC
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]
Comment 3 Krinkle 2014-10-10 20:26:12 UTC
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.
Comment 4 Krinkle 2014-10-10 20:33:54 UTC
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.
Comment 5 Krinkle 2014-10-10 20:39:13 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links