Page MenuHomePhabricator

jquery.byteLimit incorrectly limits input when using methods other than basic per-char typing
Closed, ResolvedPublic

Description

Right now it tries to predict what the complete input value will be after the keypress, and either allow or prevent that event.

However this is very unrealiable. For example if the limit is reached and you select all and begin typing, you can't because it will do (this.value + tobeinsertedkey) as prediction, and that's too long.

The solution is to watch *after* the key is pressed and then correct it. Because we can't simulate all possible ways of insertion:

  • copy/pasting
  • drag/drop
  • select>type
  • autocomplete
  • javascript-powered input methods

Initial attempt: I9ace3ab79 | https://gerrit.wikimedia.org/r/12713.
Reverted in: I1fe6a6c6 | https://gerrit.wikimedia.org/r/14175

because it caused the browser to limit the input field to 0 due to a browser bug (could be the kind of bug that is actually documented in the specification). So we'll have to do this another way.

Upstream: https://code.google.com/p/chromium/issues/detail?id=136004
Reproduced: http://jsfiddle.net/Ea48y/
See also: bug 38158


Version: 1.18.x
Severity: normal

Details

Reference
bz38163

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:55 AM
bzimport set Reference to bz38163.

Fixed in I9c204243d0bdf7158aa86a62b591ce717a36fe27.

*** Bug 35561 has been marked as a duplicate of this bug. ***

  • Bug 35560 has been marked as a duplicate of this bug. ***