Keyboard shortcuts, phase one

Please visit Announcement: Keyboard shortcuts are now integrated into the site for an updated status on this.

Blast from the past: Add keyboard shortcuts to Stack Overflow was posted in September 2009. You might have noticed that that post was recently retagged – we're working on it.

Since keyboard shortcuts are definitely a power user feature, we have decided to go about this project in a slightly different way than usual. The keyboard shortcuts will begin their life as a user script for people to try out and give feedback, so we can refine it together, until we consider it ready enough to be added to the core engine.

There is now a version for you to try out, play with, and answer the following questions:

• Does it work for you? What does, what doesn't?
• What additional actions are unquestionably in need of keyboard shortcuts? There's just a selection currently, so what more is important?

Remember, this is for the tiny percentage of people who would rather use the keyboard than the mouse to make their life easier and faster – so what should be done to achieve that?

Since this is very much work in progress, there is a version of the user script that checks for an updated version every twelve hours* and gives you a link to click and update. If you don't want this, there's also a version without this check.

*Note that it uses the localStorage to store the time of the last update check, so it's actually every twelve hours per SE site that you visit, since different origins don't share a localStorage.

Here are the two versions:

Should work in Chrome, Firefox (with Greasemonkey) and Opera (where you'll have to manually move it to your user script folder).

After installing (and possibly restarting/refreshing), ? should get you started.

Post feedback as answers here, or for small questions and remarks, chances are often good that you'll find me and other helpful people in the Tavern on the Meta.

If you're using the rchern Mafia's keyboard script, you might want to turn that off, or things could get weird :)

-
@jtbandes see the info on Stack Apps about installing userscripts. It looks like you'll need the NinjaKit extension for Safari 5. – nhinkle Aug 17 '11 at 17:31
I wish it didn't need my data on all websites... – jjnguy Aug 17 '11 at 18:43
@jjnguy: That's a long-standing chrome issue. It ignores the fact that the user script is restricted to certain sites (check in Firefox/Greasemonkey for example; you'll see that the restriction is indeed there). And Chrome indeed only runs it on the given sites, despite claiming otherwise. – balpha Aug 17 '11 at 18:45
This will conflict with quick search functionalities of browsers if no modifiers are needed for the shortcuts. – H.B. Aug 17 '11 at 19:37
@H.B.: Anything will collide with something. We've decided to go with no modifiers; if that conflicts with someone's plugins, they'll have to live with the fact that they can't use our shortcuts. – balpha Aug 17 '11 at 19:53
How is the script licensed? I whipped up a Safari extension, for myself, that injects the script. Can I release it? – elasticthreads Sep 2 '11 at 0:41
@Dori The Extension is up on GitHub here github.com/elasticthreads/StackKBShortcuts-for-Safari – elasticthreads Sep 2 '11 at 13:43
Any updates on the ETA of this feature? – Kyle Cronin Sep 26 '11 at 21:12
Interestingly, I get this error when trying to update the script as prompted. It just downloads the sekeys.updating.user.js file. Seems Chrome made it impossible to continue auto-updating the script? (v21, dev) – slhck Jun 23 '12 at 7:30
@slhck When Google decided to make non-Store extensions harder to install, they totally forgot that user scripts even exist. From that thread, it looks like they're on and off, so I can't tell you if they currently work. You can try domain whitelisting or this supposedly existing command line argument. Or use a released browser :) – balpha Jun 23 '12 at 9:13
@balpha On OSX 10.6.8 and Chrome neither of E or C seem to work after selecting a question or answer with U/J/K. I don't have conflicting scripts installed. At least none from here. Is there a way to debug this? – halirutan Nov 12 '12 at 17:43
Adding comments via C is no longer possible after the latest changes to the comment system. – slhck Jul 25 '14 at 17:28
@slhck Yep, stackapps.com/a/4817/43. And when fixing that, I'll also finally make it a part of the site instead of a user script. – balpha Jul 25 '14 at 17:39
@balpha Cool, didn't know there was an "official" StackApps entry. And hooray! :) – slhck Jul 25 '14 at 18:33

Feature request: allow "checking" of questions on the question list, and then with a question, J/K (or something like that) to navigate between checked questions. So I can view a page of questions, select those I'm interested in, and then go to each in turn.

-
By J/K I'm guessing you mean shift-j and shift-k? – jtbandes Aug 17 '11 at 17:22
I think this should be done with "x", like selecting messages in Gmail. – jtbandes Aug 17 '11 at 17:22
@jtbandes: Yes on both counts :) – Jon Skeet Aug 17 '11 at 17:29
That's a really interesting idea. – balpha Aug 17 '11 at 17:29
@balpha: Basically I'm thinking about how I can treat SO like gmail :) – Jon Skeet Aug 17 '11 at 17:31
It would be nice to have a mouse interface for that first. – jjnguy Aug 17 '11 at 18:53
@jjnguy - Or simultaneously, or one then the other. It would be nice to have it at all, I don't care too much about the order. – Kevin Vermeer Oct 12 '11 at 16:54

Would it be possible to make Esc close an open comment box triggered by c?

This would make it easier to navigate the site without having to tab through to the "Cancel" button and seems like a very consistent thing to do (escaping actions such as editing, etc.).

-

Feature request: Shortcut to go to the /tools page. Perhaps G T. This might not be the best keyboard shortcut because it'd only be usable for 10k users and mods, but it would definitely be useful for those groups of people.

In addition to this, G R to access /review would be nice as well.

-
Thanks to Rebecca, these are now available via "special pages", [G][S][T], [G][S][R] etc. – balpha Sep 16 '11 at 6:49
@balpha Actually, G-S-T does not seem to work – at least for me on Super User. There is no such option in the auto-help, and the action performs nothing. – slhck Oct 25 '11 at 21:15
@slhck Fixed, thanks. – balpha Oct 26 '11 at 7:08
@balpha Is it broken again? G-S only shows Review when you previously were on /review. If you were on \tools, G-S shows both Review and Tools. See here. – slhck Nov 18 '11 at 14:53
@slhck: Yes, there has been a change to how that link works, and I haven't yet come up with a good way to handle that. – balpha Nov 18 '11 at 14:56

Bug

Given the following conditions:

• hiding of ignored tags in user preferences enabled
• ignored tags specified by wildcard, e.g. windows* for , , etc.

The following issue occurs:

The previous (k) / next (j) buttons don't skip the questions with tags ignored by wildcard.

Since a hidden question is actually focused (even though that's invisible), enter opens it.

Notes

It works properly when ignoring tags without wildcards.

Tested environment: Safari 6.0 with NinjaKit, and Firefox 13.0.1 with Greasemonkey

-

Feature request:

Would it be possible to map F to toggle add question to favorites?

-

Enhancement request: / should focus the search field (common to many sites). I think S would be better suited as "sort by" instead of the current O for "order by".

-
.. and then you could make O open a question, like a mail in Gmail ;) – slhck Aug 23 '11 at 18:03
The problem with this is that / is the default key for searching within a page on firefox... – Benjol Sep 1 '11 at 12:42

Feature request: j/k or J/K (as suggested by Jon Skeet) while viewing a question loads the previous/next listed or checked question, without having to go back to the list. Gmail handles both this and navigating within a thread by using n/p in addition to j/k.

-
How is that different from Jon's answer? – balpha Aug 17 '11 at 18:11
@balpha: unless I misread Jon's, this is navigating while you're viewing a question whereas his was from a list. Also I think the shortcut for this should be distinct (j/k vs p/n) from navigating among answers. – jtbandes Aug 17 '11 at 18:17
Okay, that's how I read Jon's version. – balpha Aug 17 '11 at 18:43
@jtbandes: It's similar to this answer meta.stackexchange.com/questions/102769/… rather than the one which has now been implemented. – Jon Skeet Aug 19 '11 at 15:22
@Jon Skeet: are any of these currently implemented? j/k from a question navigates the answers, and J/K and p/n don't seem to do anything. – jtbandes Aug 19 '11 at 18:51
@jtbandes: No, this feature hasn't been implemented - the feature which has been implemented is making j/k keep going beyond what was previously visible. – Jon Skeet Aug 19 '11 at 19:24
@Jon Skeet: Oh, yes (which is great). Our suggestions are both in addition to that. – jtbandes Aug 19 '11 at 19:25
@jtbandes: I think the point is that my other suggestion (including checkboxes) includes your idea of loading the previous/next question. I don't think you could sensibly do it without some sort of checkbox system, as you'd rarely want to just go to "the next question with no filtering applied". Maybe for search results. – Jon Skeet Aug 19 '11 at 19:28
@Jon Skeet: Okay, sure. What was your suggestion for navigating answers within a question, versus questions? I'm suggesting p/n (again, like Gmail). – jtbandes Aug 19 '11 at 19:30
@jtbandes: I didn't have a suggestion around that, but n/p is good. – Jon Skeet Aug 19 '11 at 19:32
Userscript for that: meta.stackexchange.com/questions/201887/… – Basilevs Oct 16 '13 at 19:45

Feature request: press Esc to stop editing tags; and some keyboard shortcut for saving/cancelling a question edit.

-
The latter already exists (for inline editing, anyway): Ctrl-Enter and ESC. – balpha Aug 17 '11 at 18:12
It works for non in-line too. – Tim Aug 23 '14 at 10:34

-

Feature request/bug report: in profile j/k can be used to select a question — but no way to select an answer, it seems.

-
Yes, that's definitely planned; I just haven't figured out how to best handle the fact that there are several paginations on the user profile. – balpha Aug 19 '11 at 12:13
You can now use [N][Q] and [N][A] to switch between what section you're working with. – balpha Sep 16 '11 at 6:54

Feature-request: when summoning the inbox, change j/k navigation to inbox elements instead of posts items.

In a general manner, give j/k navigation to the most important panel shown, could be flags etc...

-

Feature-request:

Add a function that enable switching between the Stack accounts of the user could be good. I don't know how that could be done. Display the user accounts page then use J/K to select one? Or a textbox where you write the name?

-

Feature request: Under inbox, add an option to open all new messages in separate tabs. This is something I do manually by opening the inbox and middle clicking all the highlighted links, would be great if it could do it automatically.

-
I'll have a look at that, but I'm pretty sure opening several new windows at once is going to have me fighting popup blockers. – balpha Sep 2 '11 at 5:01
@balpha I think that the power users that this feature is designed for can figure out how to prevent popups from being blocked on SE – Kyle Cronin Sep 2 '11 at 5:05

The new user page breaks the tab selection window (N T with the auto help on). The options are spaced way too far apart, which makes them get cut off at the top of the window (that gray bar at the top is the tab bar).

-
Fixed, thanks. – balpha Nov 15 '11 at 8:47

I'd be in favour of either switching the function of j and k or of using a mapping that actually reflects the flow, e.g. y for previous and h for next as the layout is in most cases vertical.

-
I'd be the first to switch j and k, but these semantics (even if they don't make sense to me) are kind of a standard. – balpha Aug 17 '11 at 21:30
It's because in vi you move between lines with j and k. And vi(m) is awesome... ;) (or maybe it's because people like to play nethack (and I assume nethack has it from vi)). – Felix Aug 19 '11 at 13:15
@Felix: Being stuck with a bad layout due to a thoughtless design decision in some popular software is sad... – H.B. Aug 19 '11 at 13:20
I'd be against switching to y and h - Those aren't on my home row! Choosing j and k was not a thoughtless decision. – Kevin Vermeer Nov 1 '11 at 11:57
@KevinVermeer: Well, it was just an example, j + u would be better of course, but if you want to have vertical layout you will always have one key off, so it's a tradeoff between speed and mapping. – H.B. Nov 1 '11 at 12:02

A mapping of favourite tags to numbers might be nice, or some popup to select from. (preferably everywhere and not just on those pages where the interesting tags section is visible).

-

Feature request: in question list selecting a question should, perhaps, show question excerpt (like hovering over its title does).

-

Feature request: Ctrl+Enter to open question in new tab. This works on Google search pages :)

-
this already works in the search box – Jeff Atwood Sep 24 '11 at 21:45
This works, except that it's Shift-Enter, not Ctrl-Enter – balpha Sep 28 '11 at 15:45
@balpha. But... it IS Ctrl+Enter – user173320 Jun 24 '12 at 6:20
@gdoron Ctrl-Enter in the search box has nothing to do with the keyboard shortcuts script; this is "native" site functionality that has been working forever. We're talking about e.g. opening a question (that you have selected via j/k) in a new tab. Also see stackapps.com/a/3497/43 – balpha Jun 24 '12 at 6:32

The "email settings" dialog in the supercollider doesn't capture key events, so when I start typing in my email address the shortcuts will activate, closing that dialog and opening random other page elements.

-
Sorry about being so late; fixed now. – balpha Jun 22 '12 at 12:42

Feature request: use left/right arrow keys to browse (next/previous) questions.

-
How is next/previous defined here? Do you mean something like meta.stackexchange.com/questions/102769/…? – balpha Nov 1 '11 at 10:22
@balpha, on Newest Questions page, for example, instead of clicking "next" we could press the right arrow key. – Nick Dandoulakis Nov 1 '11 at 10:34
So you just want to change the P,N/P,P shortcuts to use the arrow keys instead? Hmm... Not a fan; I'd like to keep standard navigational keys (cursor keys, pageup/down etc.) unchanged, so they behave like the user expects them to. – balpha Nov 1 '11 at 11:07
@balpha, personally I can't find a use for left/right keys on such pages. Anyway, for a demonstration: iconfinder.com/search/?q=icon – Nick Dandoulakis Nov 1 '11 at 11:22

It seems navigation doesn't work on /tools/flagged. Is this a bug or not implemented? It would be nice if I could act on those questions using keyboard only.

-

There seems to be a bug in the script on the new login page. If you try to login using an SE account, keyboard shortcuts can prevent you from entering certain characters into the field. I'm noticing the issue on Firefox.

Repro

1. Got to the login page