WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 2 years ago

#30979 accepted enhancement

Check for context menu before closing commentReply

Reported by: jesin Owned by: SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch
Focuses: ui, administration Cc:
PR Number:

Description

Login to WP-Admin, go to the comments section and "Quick edit" or "Reply" to a comment.

Bring up the context menu either with a right-click or the menu key, press ESC and the context menu and the comment box will close.

https://i.imgur.com/xnhrZDr.png

I understand that this is the expected behaviour but this can be frustrating at times.

If you bring up the context menu while typing a long reply but decide not to autocorrect and press ESC to close the context menu everything you've typed so far is gone :(

The "Compose email" section of both Gmail and Outlook.com close themselves when ESC is pressed but don't if the context menu is open. So I thought WordPress should also have the same behaviour.

The patch checks for a right click or menu key press before doing commentReply.revert().

Attachments (2)

30979.diff (968 bytes) - added by jesin 5 years ago.
30979.2.diff (966 bytes) - added by tyxla 5 years ago.
Refreshing the patch to use on() instead of bind(). Reason: as the jQuery documentation suggests, on() is the recommended method and should be used instead of bind(). For more information: http://api.jquery.com/bind/#entry-longdesc

Download all attachments as: .zip

Change History (10)

@jesin
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 4.2

@tyxla
5 years ago

Refreshing the patch to use on() instead of bind(). Reason: as the jQuery documentation suggests, on() is the recommended method and should be used instead of bind(). For more information: http://api.jquery.com/bind/#entry-longdesc

#2 @MikeHansenMe
5 years ago

  • Keywords has-patch added

#3 @joedolson
5 years ago

  • Focuses accessibility removed

This ticket was mentioned in Slack in #core by drew. View the logs.


5 years ago

#5 @DrewAPicture
5 years ago

  • Keywords commit added

30979.2.diff still applies, and it fixes the problem for me. Moving for commit consideration.

This ticket was mentioned in Slack in #core by drew. View the logs.


5 years ago

#7 @helen
5 years ago

  • Keywords commit removed
  • Milestone changed from 4.2 to Future Release

Punting this - esc key detection is used in multiple places, do we need to consider this on the bigger picture? A single fix can go in at once, but I'm uncomfortable doing that without at least taking a holistic look. Would also be nice to be clear on what browsers and OSes this affects - I get different results between Firefox and Chrome on OSX Yosemite.

#8 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

This was brought up in a recent post on support forums (in Russian).

The current behavior of silently closing the reply form when pressing Esc was introduced in [8720] and [9098]. The reply form was initially a popup, and this appears to be a remnant of the old UI.

There should be a warning of some kind when pressing Esc on a non-empty form, or a way to recover the entered text.

Note: See TracTickets for help on using tickets.