Narayam input method does not take effect in many input boxes
Closed, ResolvedPublic

Description

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.


Version: unspecified
Severity: normal

bzimport set Reference to bz28668.
brion created this task.Via LegacyApr 22 2011, 11:49 PM
bzimport added a comment.Via ConduitApr 23 2011, 3:22 PM

junu.pv+public wrote:

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.

Catrope added a comment.Via ConduitApr 25 2011, 9:34 AM

(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.

bzimport added a comment.Via ConduitApr 25 2011, 3:41 PM

junu.pv+public wrote:

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)?

brion added a comment.Via ConduitMay 13 2011, 2:19 PM

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.

bzimport added a comment.Via ConduitJul 12 2011, 3:37 PM

junu.pv+public wrote:

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?

Catrope added a comment.Via ConduitJul 12 2011, 4:19 PM

(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.

bzimport added a comment.Via ConduitJul 17 2011, 1:58 AM

junu.pv+public wrote:

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?

bzimport added a comment.Via ConduitJul 21 2011, 9:26 PM

junu.pv+public wrote:

By r92347 and r92747 Narayam can act on all text input fields including fields added later to DOM.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.