Page MenuHomePhabricator

Save button stays disabled when copy/paste into the "enter label" field instead typing in it
Closed, ResolvedPublic

Description

Das kann leicht mit einem Event-Listener (od. observer in jQuery genannt) für das "input" JavaScript event umgangen werden.


Version: unspecified
Severity: normal
Whiteboard: storypoints: 3

Details

Reference
bz40131

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:45 AM
bzimport set Reference to bz40131.
bzimport added a subscriber: Unknown Object (MLST).

Zur Klarstellung: Copy & Paste mit der Maus/dem Kontextmenü (nicht drag & drop, da geht es) und nicht mit Strg+V

[ Original title ]

Wenn bei der Eingabe der Bezeichnung eines "Datensatzes" Copy & Paste verwendet wird, bleibt der Speichern Knopf ausgegraut

[ Description translation ]

An event listener (or, following jQuery terminology, an observer) for this input field could easily fail to catch the relevant text change.

[ Comment #1 translation ]

Clarification: to reproduce this bug, you have to copy/paste with the mouse (context menu > paste) and not with CTRL + V (this fires the event). Drag n drop doesn't work anymore to reproduce this bug.

[ Adding "javascript" keyword, this should be fixed in JS using onChange property. ]

(In reply to comment #2)

An event listener (or, following jQuery terminology, an observer) for this
input field could easily fail to catch the relevant text change.

Thanks for your translation efforts, I really appreciate this but this is unfortunately going into the wrong direction:

You simply can add an event observer for the *"input" javaScript event* (There is an event with the name "input" and according to the W3C it should fire when the contents of a an input e.g. of type "text" has changed, no matter how it was changed. It must not neccessarily fire immediately/ on each key stroke (to e.g. save resources).

http://dev.w3.org/html5/spec/common-input-element-apis.html#event-input-input

https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/input

We could not reproduce the error. On which browser did this happen?

Created attachment 11107
Step by step. How one could copy and paste.

(In reply to comment #4)
FF 15.0.1. I will upload a step-by-step screenshot. I'd say you didn't try hard but assume testers are stupid.

Attached:

WikidataRepoUIBug_Input_cant_save.png (656×739 px, 20 KB)

Reopened since still the same problem.

No, did not assume that the problem is with the user. Just wanted to know the browser. The exact workflow worked for me when testing, but I did not test on Firefox.

Confirming bug on Firefox.

'input' event does not exist on IE <=8. There are some workarounds floating around.

In older browsers you could do it like you did it before (.bind('keyup change mousedown mouseup paste -and-the-like-')) in newer browsers "input" event covers all your needs.

http://danielfriesen.name/blog/2010/02/16/html5-browser-maze-oninput-support/

Of course I would support if we would have a module in MW-core that would do what do what https://github.com/nottrobin/jQuery-html5fixes-plugin/blob/master/jquery.html5fixes.js is aimed to do (not testet, see section "// Create "input" event for browsers that don't support it.").

It is fixed now in git, and will be deployed soon on the test environment.

Verified in Wikidata demo time for sprint 16