Page MenuHomePhabricator

Save accesskey should work in DiscussionTools
Closed, ResolvedPublic

Description

Just tried out DiscussionTools, it is working beautifully! Thank you very much.

There's one thing I miss though: The ability to use Alt+S (could be different depending on system) to save a message. I noticed you can press Ctrl+Enter to save, but having the ability to use Alt+S – like you have when saving normal wiki pages – would be great.

Event Timeline

hi @jhsoby – good spot. We appreciate you filing this ticket.

A follow-up question for you: is there something about the Alt + S shortcut that led you to file this request? Note: "I'm used to it." is a perfectly valid answer :)


Note: As @matmarex shared, when deciding to implement this, we should consider T257305. Reason: the Alt + S operates on the whole page as opposed to the part of the page the user is focused on. This means, we'd have to make some assumptions about what "surface" this shortcut should target.

Sorry, didn't see your reply until now, @ppelberg. Yes, mainly the fact that I'm used to it (in fact so much so that I'm still pressing it by mistake even after actively using DiscussionTools since it became available).

As for what would happen if several replies are open at once, I would suggest something like this (doesn't need to be too complicated):

$( ".discussionform" ).on( 'focus', function() {
   $( ".all_other_discussionforms .submitbutton" ).removeAttr( "accesskey" );
   $( ".this_discussionform .submitbutton").addAttr( "accesskey", "s" );
});

It seems unlikely we would ever have a reply widget open alongside a full page editor, so I see no reason why this would conflict.

I would note that alt+shift+s is implemented as an access key, and if we did that it might be problematic if we decide you can have multiple reply widgets open in future. We could also mimic the access key behaviour as a VE trigger.

+1 to making Alt+Shift+S a hotkey that posts a reply for an already open DiscussionTools reply textbox. I tried to use it today, it would be super intuitive. All wiki save actions should use Alt+Shift+S, in my opinion.

Per today's conversation with @matmarex, we're going to implement this provided it doesn't conflict with any other accesskeys.

Note: per what @Esanders shared in T300696#7670782, we do not consider implementing this to conflict with T257305. Reason: if/when we decide to support people drafting multiple replies at once, we think people will find it intuitive that alt+++s will "act" on the Reply Tool they are currently focused "within."

Change 845056 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Add accesskey "s" to the "Reply" / "Add topic" button

https://gerrit.wikimedia.org/r/845056

Fun fact, there are many interfaces which also use "S" as a confirm/submit/save accesskey: https://codesearch.wmcloud.org/search/?q=accesskey.%2B"s"&i=nope&files=%5C.json%24&excludeFiles=&repos=. It's mostly specific special pages, so this shouldn't conflict with our use.

Change 845056 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Add accesskey "s" to the "Reply" / "Add topic" button

https://gerrit.wikimedia.org/r/845056

@matmarex , any idea what the equivalent of Alt+S would be on Mac?

Cc: @DLynch

I don't know (the shortcut also depends on your browser), but it will be shown in a tooltip if you hover on the "Reply" / "Add topic" button with the mouse cursor:

image.png (243×768 px, 9 KB)

DLynch moved this task from Blocked / Needs More Work to QA on the Editing-team (Kanban Board) board.

In Safari-on-mac it'd be ctrl-option-S. As Bartosz says, it'd depend on your browser as well -- I think it's the same in Chrome, but not in Firefox.

We've encoded all the logic about it in this file: https://doc.wikimedia.org/mediawiki-core/REL1_28/js/source/jquery.accessKeyLabel.html#jQuery-plugin-accessKeyLabel