[go: up one dir, main page]

Page MenuHomePhabricator

Input box for page protection expiry time strange behaviour: key up and down (Safari/Chrome)
Closed, ResolvedPublic

Description

Hello. When I go to a page with action=protect, the "other time" box does not work correctly. I have been able to reproduce this behaviour on Safari and Chrome, but not Firefox, leading me to suspect that this is some kind of event handling problem with the various "key" events. I have been able to reproduce this both as a local admin (metawiki) and as a global sysop (zuwiki), so this probably isn't due to local JS. My global JS may be to blame, however.

Steps to reproduce:

  1. Open Safari or Chrome with JS enabled.
  2. Log into an admin account.
  3. Go to protect a page (e.g., https://meta.wikimedia.org/wiki/User:PiRSquared17/Sandbox2?action=protect )
  4. Enter something in the "Other time" box.
  5. Try using the arrow keys to move the cursor left, or clicking to move it to a point. Also try selecting all content.

Expected result:
Works like the block "other time" input (i.e., the default behaviour of input fields).
Actual result:
Cursor moves to end of input box whenever a key is unpressed.

(My guess: probably something to do with the script that updates the expiry for "Edit" to the "Move" box, or some weird event handling problem.)


Version: 1.22.0
Severity: minor
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=33871

Details

Reference
bz52098

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:52 AM
bzimport set Reference to bz52098.
bzimport added a subscriber: Unknown Object (MLST).

Was able to verify this with midori 0.4.7, Firefox is fine.

matmarex added subscribers: Krinkle, matmarex.

This was caused by us setting the value on all inputs when one of the inputs was changed, including re-setting it on the input being edited:

		updateExpiry: function ( source ) {
			if ( !this.isUnchained() ) {
				this.getExpiryInputs().each( function () {
					this.value = source.value;
				} );
			}
			...
		},

Setting the value would reset the cursor position to the end.

But this is no longer a problem in today's browsers, because the spec has changed: re-setting value property to the same string is no longer supposed to move the text cursor to the end:

If the element's value (after applying the value sanitization algorithm) is different from oldValue, and the element has a text entry cursor position, move the text entry cursor position to the end of the text control, unselecting any selected text and resetting the selection direction to "none".

This was news to me as well :)

I found a Chromium issue where they changed this behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=712352. I didn't look for similar documentation in other browsers, but all of the ones I tested behave the same.