#7643 closed enhancement (fixed)
Gmail-like comment manipulation keyboard shorcuts
Reported by: | nbachiyski | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | js shortcuts has-patch |
Focuses: | Cc: |
Description
j - down
k - up
x - mark (check the checkbox)
a - approve current comment (not checked)
u - unapprove
d - delete
s - spam
r - reply
Implemented as a generic jquery plugin and can be easily used on any table or list. Uses jquery-hotkeys. The main idea is:
jQuery.table_hotkeys(jQuery('table.widefat'), ['a', 'u', 's', 'd', 'r']); ... <tr class="some-css-class-prefix-current"> <a class="some-css-class-prefix-u" href="...">Unapprove</a> </tr>
The plugin cycles through rows of the given table and when one of the keys in the list is pressed, it looks for an element in that row with the proper class and clicks on it. In the example above, if I press u
the Unapprove link of the current row will be clicked.
Known limitations and bugs:
- Bulk actions can't be triggered via the keyboard. If we want the interface to be consistent we have two options:
- Sacrifice either bulk shortcuts or single-comment shortcuts. I have chosen to drop bulk actions, because they need more attention (ergo, should be harder). Moreover, comments can be marked via the keyboard and if one wants to delete all comments the only action with the mouse will be to select Delete from the menu and click Apply.
- Choose different shortcuts for single-comment and bulk actions. For example Shift+u (aka U) can be bulk Unapprove and so on.
- Can't edit the comment because it is a normal link and they can't be clicked via JS. There is a workaround and we will work around it if needed.
- Clicking on an action button, which removes the comment from view, loses the currently selected comment and the user has to press j or k to bring the cursor back.
- The style for current comment is completely arbitrary (yellow background). Better ideas will be appreciated.
Attachments (9)
Change History (29)
#2
@
16 years ago
The #E4F2FD color we use everywhere might make a good active row color. It would be more distinct from the light yellow of unapproved comments.
#5
@
16 years ago
Oops, found a bug right after commit. Pressing 'a', 'u', or other actions with no rows highlighted applies the action to all rows. After you press 'j' to make the first row active it behaves properly.
#6
@
16 years ago
On Mac, Cmd+u to view source in Firefox gets overridden and interpreted as Unapprove.
@
16 years ago
Refactor much of the code and move to next or previous page on pressing next/prev at end of the current page.
#11
@
16 years ago
Here is a patch, which redirects to the next page if we have reached the page of the current one.
Also, some code duplication was refactored and the visibility checks were unified in a jquery method, which traverses 3 levels up.
#12
in reply to:
↑ 9
@
16 years ago
Replying to ryan:
Please review those commits. Both issues are now fixed for me.
They seem fine. I will send the second one upstream.
Is it possible to show the highlight on the first row only after 'j' has been pressed? That way those who don't care or know about keyboard shortcuts don't have to see the highlight, especially since they can't move the highlight by clicking on another row. Google Reader doesn't highlight until the first time 'j' is pressed or an item is clicked.