define('jira/viewissue/invoke-comment-trigger', ['jquery'], function($) { /** * Invoke the most appropriate comment trigger on page. * If the header toolbar trigger is present then invoke that. * Otherwise invoke the first link with ".add-issue-comment" class (needed for adding comments in Issue Nav list view). * * @note Used by keyboard shortcuts on the view issue page. * Specifically, the 'm' keyboard shortcut. * */ return function invokeCommentTrigger() { var addIssueComment = $(".add-issue-comment"); if (addIssueComment.length === 0) { return; } var toolbarTrigger = addIssueComment.filter(".toolbar-trigger"); if (toolbarTrigger.length > 0) { // Click issue page toolbar trigger if it's present. toolbarTrigger.click(); } else { // Otherwise click the first link on page (needed for Issue Nav list view). addIssueComment.click(); } }; });