Page MenuHomePhabricator

If you click out of a link inspector to somewhere else in the document, the link gets inserted and selected, moving your cursor away from where you clicked
Closed, ResolvedPublic8 Estimated Story Points

Description

If I create a new link (not having selected any existing text), set some target, then instead of pressing 'done' I click into the surface where the link is to go, it creates the link. Since it's now highlighted, if I then press a random character it replaces the text.

But then if I press ctrl+z to undo changes, and then ctrl+z again, I get Uncaught Error: Invalid transaction, annotation to be cleared is not set


Version: unspecified
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=66548
https://bugzilla.wikimedia.org/show_bug.cgi?id=67088

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:35 AM
bzimport set Reference to bz68590.

Created attachment 16039
Demo video of the issue

Attached:

Note that if you do this in a block slug, the first character you type in goes into the paragraph above(!), not where the cursor is.

The video you attached is of a different bug. If you click exactly where the cursor was, the inspector stays open. If you click elsewhere in the document you get Alex's bug.

This is now three bugs:

  • If you click out of an inspector somewhere else in the document, the link gets inserted and selected, moving your cursor away from where you clicked. This is this bug.
  • If you type while a link is selected the transaction stored is not quite right, so the first undo looks wrong, and the second throws an exception. This is bug 68677.
  • If you click in exactly where the cursor was, the inspector doesn't close. This is difficult to do and doesn't cause any corruption so is relatively minor, and is bug 68679

What is the expected behavior? Discarding the input in the inspector? Making it impossible to close the inspector by clicking away? I can see these being more annoying than what happens now.

To be clear, I suggest WONTFIX. The original major issue here (broken undo) has been split to bug 68677 and fixed a long time ago.

(In reply to Bartosz Dziewoński from comment #6)

To be clear, I suggest WONTFIX. The original major issue here (broken undo)
has been split to bug 68677 and fixed a long time ago.

The original report mentioned two problems. The second is still happening.

(In reply to Alex Monk from comment #0)

If I create a new link (not having selected any existing text), set some
target, then instead of pressing 'done' I click into the surface where the
link is to go, it creates the link. Since it's now highlighted, if I then
press a random character it replaces the text.

But then if I press ctrl+z to undo changes, and then ctrl+z again, I get
Uncaught Error: Invalid transaction, annotation to be cleared is not set

  1. Cursor in empty paragraph.
  2. Click "Link" tool
  3. Enter page name or url and select it from suggestions.
  4. Move cursor back into (empty) paragraph.
  5. Type some text.

Issues:

  • The first character of the entered text is completely ignored. The link defaults to the page name as its label, but is not rendered in the surface until the first character is entered (the moving of the cursor does nothing; I'd say the move of the cursor is when the automatic insertion should happen; the entering of text should either be treated as regular text input or as the desired label, not as trigger to render the link).
  • The second character becomes the new label of the link (since the first character triggered its insertion and immediate selection).
  • The third character should extend the label (per link trail), but instead becomes regular text adjacent to the link.

Simplified:

Empty paragraph -> insert link to Main Page -> focus document (observe nothing changing, so user expects its safe to type quickly) -> type "abc" -> [[Main_Page|b]]c

(In reply to Krinkle from comment #7)

(In reply to Bartosz Dziewoński from comment #6)

To be clear, I suggest WONTFIX. The original major issue here (broken undo)
has been split to bug 68677 and fixed a long time ago.

The original report mentioned two problems. The second is still happening.

Yes, and it's filed as bug 68679. Comment 4 explains this perfectly.

Reverting summary change

Re-tested the original scenario(production) - Uncaught Error... in Console is not displayed anymore.

Otherwise the bug is still there as it's described (also as Described by Esanders).

Should the link be inserted *only* after clicking on Done button?

Jdforrester-WMF set Security to None.
Jdforrester-WMF edited a custom field.

Change 193293 had a related patch set uploaded (by Trevor Parscal):
Add insert/edit modes to FragmentInspector

https://gerrit.wikimedia.org/r/193293

Change 193293 merged by jenkins-bot:
Add insert/edit modes to FragmentInspector

https://gerrit.wikimedia.org/r/193293

Jdforrester-WMF renamed this task from VisualEditor: If you click out of a link inspector to somewhere else in the document, the link gets inserted and selected, moving your cursor away from where you clicked to If you click out of a link inspector to somewhere else in the document, the link gets inserted and selected, moving your cursor away from where you clicked.Mar 2 2015, 8:48 PM
Jdforrester-WMF closed this task as Resolved.
Jdforrester-WMF moved this task from Accepted to Done on the VisualEditor 2014/15 Q3 blockers board.

Verified the fix in beta - as it's described in https://gerrit.wikimedia.org/r/#/c/193293/: Don't insert anything when clicking away from a fragment inspector in insert mode, and don't show the senseless "remove" button then either.