Make WordPress Core

Opened 5 months ago

Closed 3 months ago

Last modified 3 months ago

#62346 closed defect (bug) (fixed)

"Close comment reply form on Escape" feature causes accidental sabotage

Reported by: yellowafterlife's profile yellowafterlife Owned by: joedolson's profile joedolson
Milestone: 6.8 Priority: normal
Severity: normal Version: 6.6.2
Component: Comments Keywords: has-patch commit
Focuses: ui, accessibility, javascript, administration Cc:

Description

This is kind of like #54548, but in a different scenario.

Here's a thing that happens every now and then:

  • I write an in-depth reply to a comment.
  • I decide to double-check spelling, so I press Menu to open the context menu.
  • "Check Spelling" turns out to be already on, so I press Escape to dismiss the context menu.
  • This snippet catches the "keyup" event, closing the comment reply form and dismissing everything that I just typed.
  • I let out a disappointed sigh and write a much shorter reply.

But there's more! This only happens in Firefox - in Chromium-based browsers the keyup event doesn't seem to be triggered at all (?)

Change History (9)

#1 @sabernhardt
5 months ago

  • Component changed from General to Comments

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


4 months ago

#3 @joedolson
4 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to joedolson
  • Status changed from new to accepted

Thanks for reporting this! That's certainly irritating. I attempted to reproduce this following your instructions, but wasn't able to right away; however, I'm going to milestone this for 6.8 for further exploration to try and resolve it.

#4 @yogeshbhutkar
4 months ago

I was able to reproduce the bug spotted by @yellowafterlife. I confirm that this occurs only in Safari and Firefox; as pointed out by the author, it works as expected in Chromium-based Web Browsers.

Here are the simplified steps to replicate the same.

  1. Open a Web Browser and navigate to the Comments Menu.
  2. Click on reply on any comment.
  3. Type something and right-click within the comment box to open the context menu.
  4. Now hit escape.

On Chromium-based Web Browsers, just the context menu would close. However, on Safari and Firefox, the context menu and the comment box closes which also wipes off the earlier written comment.

This ticket was mentioned in PR #7786 on WordPress/wordpress-develop by @yogeshbhutkar.


4 months ago
#5

  • Keywords has-patch added

### Description
Previously, in Firefox and Safari, pressing the Escape key while the context menu was open (activated by right-clicking) inside the comments form in the comments menu of wp-admin would close both the context menu and the comment form. This resulted in the removal of the written comment, forcing the user to rewrite it.

### How was it fixed?
By using the contextmenu event, I was able to manage the state that controls the closing of the comment form when the context menu is open.

### Screencast of the fix:

https://github.com/user-attachments/assets/9b27cd45-3442-415c-8626-e334de715438

Trac ticket: https://core.trac.wordpress.org/ticket/62346

@joedolson commented on PR #7786:


3 months ago
#6

This looks good to me; just made a couple of minor changes to comments and the variable declaration pattern.

#7 @joedolson
3 months ago

  • Keywords commit added

#8 @joedolson
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 59514:

Comments: Avoid reverting comment reply when context menu is open.

Fix a bug where a comment reply would be discarded if esc was pressed to dismiss the context menu in Safari or Firefox.

Checks whether the contextmenu is open and ignores the esc key if it is.

Props yellowafterlife, yogeshbhutkar, joedolson.
Fixes #62346.

@joedolson commented on PR #7786:


3 months ago
#9

Closed in r59514

Note: See TracTickets for help on using tickets.