mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@58981 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c5a5c20445
commit
583bbce947
@ -98,7 +98,7 @@ window.addComment = ( function( window ) {
|
||||
|
||||
// Submit the comment form when the user types [Ctrl] or [Cmd] + [Enter].
|
||||
var submitFormHandler = function( e ) {
|
||||
if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 ) {
|
||||
if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 && document.activeElement.tagName.toLowerCase() !== 'a' ) {
|
||||
commentFormElement.removeEventListener( 'keydown', submitFormHandler );
|
||||
e.preventDefault();
|
||||
// The submit button ID is 'submit' so we can't call commentFormElement.submit(). Click it instead.
|
||||
|
Loading…
x
Reference in New Issue
Block a user