Keep input focus when switching from VE to wikitext editing
Closed, ResolvedPublic1 Story Points

Description

When the user switches between rich text and wikitext in an input area on flow, the input area should remain active so that the user can keep typing. Currently this is not happening when changing from VE to wikitext (it works the other way around).

Switching the editing mode should always move the input focus back to the text area.

UPDATED:
The cursor should be at the end of the existing text, not the beginning -- the purpose is to keep typing, without another click.

Pginer-WMF updated the task description. (Show Details)
Pginer-WMF raised the priority of this task from to High.
Pginer-WMF raised the priority of this task from High to Needs Triage.
Pginer-WMF removed a project: Design.
Pginer-WMF set Security to None.
Pginer-WMF added subscribers: Pginer-WMF, Aklapper, DannyH.
DannyH triaged this task as Normal priority.Apr 27 2015, 4:51 PM
DannyH moved this task from Untriaged to Team discussion on the Collaboration-Team-Triage board.
DannyH edited a custom field.Apr 27 2015, 6:16 PM

Change 220665 had a related patch set uploaded (by Catrope):
Create an OOUI editor widget

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

Change 220665 merged by jenkins-bot:
Create an OOUI editor widget

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

Mooeypoo assigned this task to Catrope.Aug 12 2015, 11:05 PM
Mooeypoo added a subscriber: Mooeypoo.

This should be fixed now.

Currently, switching

  • from wikitext to VE: the cursor is moved to the beginning of the line where the cursor was positioned
  • from VE to wikitext: the focus is lost

Change 231310 had a related patch set uploaded (by Mooeypoo):
Focus the editor on switch

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

Change 231405 had a related patch set uploaded (by Catrope):
Fix editor focusing issues

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

Change 231310 abandoned by Mooeypoo:
Focus the editor on switch

Reason:
Fixed in another commit

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

Change 231405 merged by jenkins-bot:
Fix editor focusing issues

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

Etonkovidova added a comment.EditedAug 14 2015, 7:18 PM

To confirm that it's acceptable:

  • When switching to a different editor - the focus will be brought to the beginning of text of the page.

e.g A a user is typing in VE mode and decides to insert a template, switches to wikitext, then her cursor will be placed at the beginning of the text.

DannyH updated the task description. (Show Details)Aug 19 2015, 6:44 PM
DannyH added a comment.EditedAug 19 2015, 6:47 PM

I'm moving this back to In Development, for two issues:

The cursor should always be at the end of the existing text, not the beginning. The purpose is to let the user continue typing, without another click.

In Firefox, the current patch for this ticket works going from VE to wikitext, but it doesn't work for wikitext to VE. In the wikitext --> VE direction, it's the old behavior, with no cursor in the field.

Change 232785 had a related patch set uploaded (by Catrope):
After switching editors, move cursor to end

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

Change 232785 had a related patch set uploaded (by Catrope):
After switching editors, move cursor to end

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

This puts the cursor at the end when switching. I haven't yet figured out why focusing VE doesn't work in Firefox; that might be a VE bug.

I haven't yet figured out why focusing VE doesn't work in Firefox; that might be a VE bug.

It was: T109805: Focusing VisualEditor does not work in Firefox

Change 232785 merged by jenkins-bot:
After switching editors, move cursor to end

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

The cursor should always be at the end of the existing text, not the beginning.

Done. Even if a cursor is in the middle of multi-paragraph text, switching to/from VE(or wikitext), will place the cursor at the beginning of the text.

In Firefox, the current patch for this ticket works going from VE to wikitext, but it doesn't work for wikitext to VE. In the wikitext --> VE direction, it's the old behavior, with no cursor in the field.

Works for new posts. When editing saved posts - it's the same old behavior in Chrome and FF:

  • switching from VE->wikitext: focus is lost.
  • switching from wikitext ->VE: the cursor is placed at the beginning of present text

The issues with keeping focus while editing was filed as a separate issue - T110093

DannyH closed this task as Resolved.Aug 24 2015, 8:39 PM

Looks good -- I moved Elena's ticket about editing posts into the backlog queue.