WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 10 days ago

#41545 assigned enhancement

Allow cmd/ctrl-enter to submit comment forms

Reported by: helen Owned by: adamsilverstein
Milestone: 4.9.7 Priority: normal
Severity: minor Version:
Component: Comments Keywords: good-first-bug needs-testing has-patch
Focuses: javascript Cc:

Description

It's become fairly common for comment/reply forms on the web to be submitted with cmd/ctrl-enter. Some quick examples include Twitter and GitHub, neither of which tells you as far as I've seen but rather just lets you discover it works. I think it'd be a nice enhancement for comment forms in both the admin and front end to submit this way. In particular, it would make managing and responding to comments a little smoother.

Attachments (2)

41545.diff (59.2 KB) - added by Lindstromer 11 months ago.
Added support for Ctrl/Cmd+Enter to submit replies in wp-admin and frontend. + code style for the specified js-files.
41545.2.diff (2.6 KB) - added by Lindstromer 11 months ago.
PHPStorm bugged with code style messing up files in previous diff. Also added html-file that was missed.

Download all attachments as: .zip

Change History (7)

#1 @Lindstromer
11 months ago

I'll try and submit a patch for it tomorrow, the wp-admin part is solved but front end needs a little more work.

@Lindstromer
11 months ago

Added support for Ctrl/Cmd+Enter to submit replies in wp-admin and frontend. + code style for the specified js-files.

#2 @Lindstromer
11 months ago

  • Keywords needs-testing has-patch added; needs-patch removed

The patch is functioning in Firefox, Safari and Chrome on OS X when using Ctrl or Cmd + Enter. Needs testing on different operating systems to see that it picks upp the key kombination as expected.

The solution isn't to clean for the frontend part, where I had to workaround the fact that submit() is overwritten by the submit-button id.

An alternative would be to refactor the whole form output and give it a better id but I'm guessing that it could create issues.

@Lindstromer
11 months ago

PHPStorm bugged with code style messing up files in previous diff. Also added html-file that was missed.

#3 @DrewAPicture
5 months ago

  • Owner set to lindstromer
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed".

#4 @adamsilverstein
10 days ago

  • Owner changed from lindstromer to adamsilverstein

#5 @adamsilverstein
10 days ago

  • Milestone changed from Awaiting Review to 4.9.7
Note: See TracTickets for help on using tickets.