Edgewall Software
Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11510 closed defect (fixed)

The auto preview xhr request is sent on Firefox with IME active even if a user is inputting text

Reported by: t2y <tetsuya.morimoto@…> Owned by: t2y <tetsuya.morimoto@…>
Priority: low Milestone: 0.12.6
Component: ticket system Version: 1.0-stable
Severity: minor Keywords:
Cc: Jun Omae Branch:
Release Notes:

Fix auto-preview not working when editing using IMEs on Firefox and using "cut" and "paste" of context menu.

API Changes:
Internal Changes:

Description

This issue is occurred on Firefox only with special state. Because, Firefox never fired the keydown or keypress event with IME active. I confirmed this is not reproduced on Chrome32 and IE8.

However, for IME user (Asian people only?), we are typing alphabetical character and mother language switching the IME mode. So, the auto preview xhr request is sent since it is not called clearTimeout during inputting own language.

It can be avoided to observe the input event for INPUT and TEXTAREA.

Attachments (0)

Change History (9)

comment:1 by t2y <tetsuya.morimoto@…>, 10 years ago

This is a patch to fix for 1.0-stable branch. Could you review it.

https://github.com/t2y/trac/commit/a993e01048578ccb1079f365076b30851c4faadf

comment:3 by t2y <tetsuya.morimoto@…>, 10 years ago

I updated my patch by adding the propertychange event for IE8.

https://github.com/t2y/trac/commit/5a1d31146711cd8193fbf1d35dc2e11f9db134ba

comment:4 by Jun Omae, 10 years ago

It would be simple to add input event to detect editing using IMEs while auto-preview.

ref. https://developer.mozilla.org/en-US/docs/Web/Reference/Events/input.

  • trac/htdocs/js/auto_preview.js

    diff --git a/trac/htdocs/js/auto_preview.js b/trac/htdocs/js/auto_preview.js
    index c0c790a..29ccda2 100644
    a b  
    9292    }
    9393
    9494    var values = form.serializeArray();
    95     return inputs.each(function() {
    96       $(this).keydown(trigger).keypress(trigger).change(trigger).blur(trigger);
    97     });
     95    // use "input" event to detect editing using IMEs on Firefox (#11510)
     96    return inputs.bind('input keydown keypress change blur', trigger);
    9897  };
    9998
    10099  // Enable automatic previewing to <textarea> elements.
     
    150149        return true;
    151150      }
    152151
    153       $(this).keydown(trigger).keypress(trigger).blur(trigger);
     152      // use "input" event to detect editing using IMEs on Firefox (#11510)
     153      $(this).bind('input keydown keypress blur', trigger);
    154154    });
    155155  };
    156156})(jQuery);

comment:5 by t2y <tetsuya.morimoto@…>, 10 years ago

Oh, it's quite simple! :) I tried jomae's patch and it works.

comment:6 by Jun Omae, 10 years ago

Milestone: 1.0.30.12.6
Owner: set to Jun Omae
Status: newassigned

Also cut and paste of context-menu lead the same issue on Internet Explorer 8 and 11. In Firefox and Chrome, the cut and paste raise "input" event.

I revised my patch. I think we should fix it in 0.12-stable.

  • trac/htdocs/js/auto_preview.js

    diff --git a/trac/htdocs/js/auto_preview.js b/trac/htdocs/js/auto_preview.js
    index c0c790a..a1dfd1b 100644
    a b  
    9292    }
    9393
    9494    var values = form.serializeArray();
    95     return inputs.each(function() {
    96       $(this).keydown(trigger).keypress(trigger).change(trigger).blur(trigger);
    97     });
     95    // See #11510
     96    return inputs.bind('input cut paste keydown keypress change blur',
     97                       trigger);
    9898  };
    9999
    100100  // Enable automatic previewing to <textarea> elements.
     
    150150        return true;
    151151      }
    152152
    153       $(this).keydown(trigger).keypress(trigger).blur(trigger);
     153      // "input" event to detect editing using IMEs on Firefox,
     154      // "cut" and "paste" events to detect editing using context
     155      // menu on Internet Explorer (#11510)
     156      $(this).bind('input cut paste keydown keypress blur', trigger);
    154157    });
    155158  };
    156159})(jQuery);

comment:7 by Jun Omae, 10 years ago

Cc: Jun Omae added
Resolution: fixed
Status: assignedclosed

Fixed in [12560] and merged in [12561] and [12562]. Thanks for reporting and patch!

comment:8 by Jun Omae, 10 years ago

Owner: changed from Jun Omae to t2y <tetsuya.morimoto@…>
Release Notes: modified (diff)

comment:9 by t2y <tetsuya.morimoto@…>, 10 years ago

That's good to know. Thank you, too!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain t2y <tetsuya.morimoto@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from t2y <tetsuya.morimoto@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.