Last modified: 2013-10-29 07:39:29 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 T30668, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28668 - Narayam input method does not take effect in many input boxes
Narayam input method does not take effect in many input boxes
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Narayam (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Junaid
:
Depends on:
Blocks: 21781 56295
  Show dependency treegraph
 
Reported: 2011-04-22 23:49 UTC by Brion Vibber
Modified: 2013-10-29 07:39 UTC (History)
5 users (show)

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


Attachments

Description Brion Vibber 2011-04-22 23:49:27 UTC
The Narayam input method doesn't take effect in a lot of input fields, including but not limited to:

* Search box
* edit summary
* real name, signature on prefs
* reason box on deletion

These appear to have no type attribute, which seems to cause them not to match any of these selectors:

$.narayam.addInputs( 'input[type=text], input[type=search], input[type=], textarea' );

Changing 'input[type=]' to 'input' fixes them, but would presumably also try to apply to checkboxes, radios, etc. Either needs a selector to match things with *no* type attribute, or just hit them all and let the setup function worry about changing them.

More generally though, I suspect that the current bindings will fail to engage when inputs or textareas are added later, for instance by a popup dialog. Instead of binding events on every individual input field, it might be wise to do some kind of global .live() check on focus/blur to activate the keyboard bindings on a given field.
Comment 1 Junaid 2011-04-23 15:22:10 UTC
I was working at you mentioned boxes before!
You can check its original working at Malayalam Wikipedia: http://ml.wikipedia.org/ (Not recent version)

I have to check to find why it is not working now.
Comment 2 Roan Kattouw 2011-04-25 09:34:24 UTC
(In reply to comment #0)
> Changing 'input[type=]' to 'input' fixes them, but would presumably also try to
> apply to checkboxes, radios, etc. Either needs a selector to match things with
> *no* type attribute, or just hit them all and let the setup function worry
> about changing them.
> 
Be very careful about cross-browser compatibility here. Edge cases such as matching type-less inputs with input[type=] or input:not([type]) or whatever seem to work differently in different browsers.

> More generally though, I suspect that the current bindings will fail to engage
> when inputs or textareas are added later, for instance by a popup dialog.
> Instead of binding events on every individual input field, it might be wise to
> do some kind of global .live() check on focus/blur to activate the keyboard
> bindings on a given field.
Yeah, I thought about this, but never got to it. Because existence isn't an event that you can live(), I think you would have to use delegate() on the body or something.
Comment 3 Junaid 2011-04-25 15:41:32 UTC
Sorry, my previous comment typed wrongly.

I mean,

It was working before at those boxes.

I think something out of Narayam causes this issue, any jQuery update or anything else in Mediawiki?

Vibber, see, it is working fine at Malayalam Wikipedia (http://ml.wikipedia.org)?
Comment 4 Brion Vibber 2011-05-13 14:19:12 UTC
There seem to be some differences with $wgHtml5 on vs off; on wikipedia sites it's still off but it's on by default on new installations.

Both seem to have jquery 1.4.4 currently, so the native jquery behavior shouldn't be different... I think it's actually the 'type="text"' attribute being dropped in $wgHtml5 mode.
Comment 5 Junaid 2011-07-12 15:37:13 UTC
What about putting this line too?

$.narayam.addInputs($('input').not('[type]'));  // All inputs that don't have type attribute


But I have not tested it because current jQuery that mediawiki use, v1.6.2, have a bug that prevent Narayam from working.

I want to discuss about it, probably better to discuss on IRC or another bug report. Anyway giving a line.

Please see this bug of jQuery: http://bugs.jquery.com/ticket/9301
especially this comment: http://bugs.jquery.com/ticket/9301#comment:20

Should we make all data key names to 'camelCase' or just wait for fixed jQuery?
Comment 6 Roan Kattouw 2011-07-12 16:19:46 UTC
(In reply to comment #5)
> What about putting this line too?
> 
> $.narayam.addInputs($('input').not('[type]'));  // All inputs that don't have
> type attribute
> 
> 
> But I have not tested it because current jQuery that mediawiki use, v1.6.2,
> have a bug that prevent Narayam from working.
> 
> I want to discuss about it, probably better to discuss on IRC or another bug
> report. Anyway giving a line.
> 
> Please see this bug of jQuery: http://bugs.jquery.com/ticket/9301
> especially this comment: http://bugs.jquery.com/ticket/9301#comment:20
> 
> Should we make all data key names to 'camelCase' or just wait for fixed jQuery?

Since it's easy to work around the bug and make all key names camelcase, you might as well just do that.
Comment 7 Junaid 2011-07-17 01:58:01 UTC
Unfortunately my above line
$.narayam.addInputs($('input').not('[type]'));
not worked. Then I tried with jQuery's proprietary :text selector and found working (no performance boost). So used it in code and made a commit (r92347, forgot to mention this bug id on commit message)

As Brion noted out it was a problem that the extension has no effect on input fields added to DOM later. So I tried with jQuery's live() function, found it working :)

I have installed changed extension on my testwiki: http://testwiki.junaidpv.in
the site has HotCat installed, it is working on HotCat's fields, you may try it.

My code diff is: https://gist.github.com/1087017

Should I commit the change or any suggestions?
Comment 8 Junaid 2011-07-21 21:26:39 UTC
By r92347 and r92747 Narayam can act on all text input fields including fields added later to DOM.

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


Navigation
Links