Make WordPress Core

Changeset 58981

Timestamp:
09/03/2024 08:34:35 PM (2 weeks ago)
Author:
joedolson
Message:

Comments: Limit comments shortcut to not execute on links.

Exclude links from activating the comment submission shortcut.

[45790] introduced a shortcut to submit comment forms using Ctrl/Cmd + Enter. This keyboard combination is also the combination for opening a link in a new tab, which resulted in submitting the form when using the Log Out or Edit Profile links.

Props greentreefrog, sabernhardt, narenin.
Fixes #61919.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/comment-reply.js

    r55044 r58981  
    9999        // Submit the comment form when the user types [Ctrl] or [Cmd] + [Enter].
    100100        var submitFormHandler = function( e ) {
    101             if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 ) {
     101            if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 ) {
    102102                commentFormElement.removeEventListener( 'keydown', submitFormHandler );
    103103                e.preventDefault();
Note: See TracChangeset for help on using the changeset viewer.