Page MenuHomePhabricator

AddLinkArticleTarget: Handle escape key in more elegant way
Closed, ResolvedPublic

Description

Desired behavior:

  • If the user has not not tapped "yes" or "no": esc goes right to read mode.
  • If the user has tapped "yes" or "no": esc brings up an "are you sure" dialog, and another esc makes that dialog go away and the user is back with the link inspector.

Pressing escape seems to close the toolbar dialog but leaves the annotated suggestions in place; pressing escape again switches to read mode. To be consistent with the rest of the VE experience, we should probably make it so that pressing escape closes the toolbar dialog and switches to read mode (so no intermediate state where there are highlighted annotations but no toolbar dialog). @RHo what do you think?

Event Timeline

kostajh triaged this task as Medium priority.May 6 2021, 7:38 PM
kostajh created this task.
VE esc button behavior (betalabs):some edits are doneAdd link esc button behavior (betalabs):
some edits are done ('Yes' or 'No' are clicked)
- open VE and type some text
- click esc - the dialog popup appears asking to continue edit or to discard edits
- click esc again - the dialog disappear, a user is still in VE mode
- get to an article with add link suggestions - the Add link context item is open; click 'Yes'
- click esc - the context item disappears and it's not possible to bring it back
- click 'No' - the same behavior as with Yes
VE esc button behavior (betalabs):
no edits are done**
Add link esc button behavior (betalabs):
no edits are done
- open VE
- click esc - a user is returned to Read mode
- get to an article with add link suggestions
- (the link inspector is open) click esc (make sure that a cursor is placed inside the link inspector)
- the link inspector disappears and it's not possible to bring it back without reloading a page

@RHo @MMiller_WMF Should we prevent the escape key from closing the recommended link toolbar dialog? Normally I would say no, both because it's inconsistent with how other VE dialogs & tools operate. But in this case, the dialog should remain open for as long as the article is in machineSuggestions mode, and further pressing escape and switching to read mode might be confusing for the user.

@RHo @MMiller_WMF Should we prevent the escape key from closing the recommended link toolbar dialog? Normally I would say no, both because it's inconsistent with how other VE dialogs & tools operate. But in this case, the dialog should remain open for as long as the article is in machineSuggestions mode, and further pressing escape and switching to read mode might be confusing for the user.

hi @kostajh - I agree that the link inspector should not be closed when esc is pressed (either with or without machine suggestions reviewed). However, it seems there is no other keyboard action that allows a person to exit out of edit mode besides using the esc key, so I do think it's important to show an "are you sure you want to leave" dialog (appearing over the still open link inspector) that gives the user the option to exit or continue. We could use the standard "you are exiting the editor" dialog per the comment @MMiller_WMF made on T269653#7040330:

@kostajh -- for wikis that have multiple edit tabs, yes, the "Edit source" tab should do the same thing as the edit mode toggle (show the special dialog, etc.)

But for all other ways to exit the experience (e.g. clicking "Read", clicking a left nav item, clicking the Wikipedia logo, etc.) we should hand the user the standard "you are exiting the editor" experience.

I see that in some cases, like clicking the left nav, that looks like this:

image.png (168×436 px, 22 KB)

And in other cases, like clicking "Read", that looks like this:

image.png (163×320 px, 13 KB)

Inheriting all of that is fine. If this sounds good, please say so and I'll add it to the task description. Or feel free to add it yourself.

@kostajh -- I think I agree (though I'm not sure which element you mean by "recommended link toolbar dialog"). I'm thinking it should try to follow how VE operates now, like:

  • If the user has not not tapped "yes" or "no": esc goes right to read mode.
  • If the user has tapped "yes" or "no": esc brings up an "are you sure" dialog, and another esc makes that dialog go away and the user is back with the link inspector.

Are we all saying the same thing?

@kostajh -- I think I agree (though I'm not sure which element you mean by "recommended link toolbar dialog").

That's technically what the link inspector was transformed into when we did T267706: Add a link in VE: Use a permanent context instead of VE's built-in context, instead of a transient link inspector that's created & destroyed as individual links are interacted with, it's a toolbar dialog that is permanently open. In practice, it's probably OK for us to use those terms interchangeably as long as we all know that we are referring to the same thing :)

I'm thinking it should try to follow how VE operates now, like:

  • If the user has not not tapped "yes" or "no": esc goes right to read mode.
  • If the user has tapped "yes" or "no": esc brings up an "are you sure" dialog, and another esc makes that dialog go away and the user is back with the link inspector.

Are we all saying the same thing?

Yes, that makes sense. I'll update the task description.

Change 690754 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Add Link: close editor on Esc key

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

Change 690755 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Add Link: Keep focus on the link inspector dialog

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

Change 690754 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add Link: close editor on Esc key

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

Change 690755 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add Link: Keep focus on the link inspector dialog

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

Checked in wmf.14 - works as expected, i.e. as it was stated below:

  • If the user has not not tapped "yes" or "no": esc goes right to read mode.
  • If the user has tapped "yes" or "no": esc brings up an "are you sure" dialog, and another esc makes that dialog go away and the user is back with the link inspector.