[Tracker-discuss] [issue422] Keyboard shortcuts

2012-05-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

This seems to work fine and no one complained, so I'm closing it.
Thanks everyone for the feedback!

--
status: testing -> resolved

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-24 Thread Ezio Melotti

Ezio Melotti  added the comment:

I added a note under the table, tweaked a few minor things and committed the 
patch in r88929.

http://svn.python.org/view?view=revision&revision=88929

--
status: chatting -> testing

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

> If it’s obvious for Vim users and irrelevant for other people,
> we can also just say nothing (maybe a commen in the source).
But if I don't mention it somewhere it's not obvious.  If the Vim "mode"* is 
mentioned somewhere, Vim users will just pick that up and the others will 
simply ignore it.  If it's not mentioned Vim users might not realize that the 
second set of shortcuts comes from Vim, and non-Vim users will wonder what the 
second (unintuitive) set is for.
Mentioning that all the shortcuts always work might be enough, otherwise I can 
put them together and mention that the alternatives mimic Vim's shortcuts (an 
advantage of keeping them separate is that users will just need to look at a 
single column once they decide if they want to use the Vim "mode" or not).

* note that even if I'm calling it "mode", I agree that it's a confusing term 
and it shouldn't be used in the doc

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-05 Thread Éric Araujo

Éric Araujo  added the comment:

> I was considering that, but since there's no evident way to select the 
> "mode", people will
> just try to use whatever they prefer and regardless of what it is it will work
I still think using a table can be confusing.  There is no mode, so let’s not 
suggest there are modes, just list the shortcuts.

> (vim should be mentioned somewhere, to clarify what's the second set of keys 
> is for).
If it’s obvious for Vim users and irrelevant for other people, we can also just 
say nothing (maybe a commen in the source).

> I'm not sure the 'shift' needs to be mentioned, you say either A or shift+a, 
> and here the key is '?',
> not shift+?.
Oh you’re right, I was confused by Anatoly’s earlier mention of “Shift+?”, but 
the character triggering the help pop-up is “?”.  So that’s one more that can’t 
be used for find as you type.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

I was considering that, but since there's no evident way to select the "mode", 
people will just try to use whatever they prefer and regardless of what it is 
it will work (vim should be mentioned somewhere, to clarify what's the second 
set of keys is for).  Once I rework the tracker doc in the devguide I'm 
planning to add a section to describe the keyboard shortcuts.
Another option is to write under the table that both the "modes" are always 
"enabled".
I'm not sure the 'shift' needs to be mentioned, you say either A or shift+a, 
and here the key is '?', not shift+?.  Depending on the layout, it might be 
either shift+7, shift+', shift+/, shift+,, etc.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-05 Thread Éric Araujo

Éric Araujo  added the comment:

The problem with the table is that it may suggest that users need to choose one 
of mnemonic or vim-style.  A simpler alternative might be something like:


Keyboard Shortcuts

  first message: *f* or *h*
  previous message: *p* or *k*
  ...
  this help: *Shift+?*

(using ** to suggest “strong” HTML elements)

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-12-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

Attached patch and screenshot for a popup window with the description of the 
shortcuts that appears when '?' is pressed.

___
PSF Meta Tracker 

___Index: style.css
===
--- style.css   (revision 88927)
+++ style.css   (working copy)
@@ -531,3 +531,40 @@
 max-width: 20em;
 overflow: auto;
 }
+
+/* styles for the keyboard shortcut help popup */
+div#shortcuts-help {
+background-color: #efefef;
+border: 1px solid #afafaf;
+position: fixed;
+top: 6em;
+left: 50%;
+z-index: 42;
+width: 400px;
+margin-left: -200px;
+padding: 1em;
+text-align: center;
+opacity: 0.95;
+}
+div#shortcuts-help table {
+margin: 0 auto 1em;
+border: 1px solid #afafaf;
+}
+div#shortcuts-help caption {
+font-weight: bold;
+padding: .2em;
+}
+div#shortcuts-help th, div#shortcuts-help td {
+text-align: center;
+padding: .2em;
+background-color: #dd;
+}
+div#shortcuts-help tr th:first-child {
+text-align: right;
+}
+div#shortcuts-help span {
+cursor: pointer;
+border: 1px solid #afafaf;
+padding: .2em;
+background-color: #dd;
+}
Index: issue.item.js
===
--- issue.item.js   (revision 88927)
+++ issue.item.js   (working copy)
@@ -56,31 +56,48 @@
 // scroll the page to the given node
 window.scrollTo(0, node.offset().top)
 }
-function add_help() {
-// add some help to the sidebar
-$(['Keyboard shortcuts',
-   '',
-   '  f/h: first msg',
-   '  p/k: previous msg',
-   '  n/j: next msg',
-   '  l: last msg',
-   '  r/i: focus textarea',
-   '  ESC: unfocus textarea',
-   ''].join('\n')).appendTo('div#menu ul.level-two');
-// the empty  are just an hack to get the style right,
-// this help will anyway be moved to the devguide soon
+function create_help_popup() {
+// create a popup that lists the available shortcuts
+var div = $([
+   '',
+   '  Keyboard shortcuts',
+   '  mnemonicvim-style',
+   '  first messagefh',
+   '  previous messagepk',
+   '  next messagenj',
+   '  last messagell',
+   '  focus textareari',
+   '  unfocus textareaEscEsc',
+   '  shortcuts help??',
+   '',
+   'Close shortcuts 
help'].join('\n'))
+// this should point to the devguide once a section with the shortcuts
+// is added
+//$('Keyboard shortcuts (?)').appendTo(
+//'div#menu ul.level-three:last');
+div.find('span').click(function() { div.hide() })
+div.hide()
+div.appendTo('body');
 }
-add_help()
+create_help_popup()
+
+var help_popup = $('#shortcuts-help');
 var textarea = $('textarea').first();
 var messages = $('table.messages tr th a:first-child');
 var last_index = messages.length - 1;
 // start from -1 so 'n' sends to the first message at the beginning
 var current = -1;
 $(document).keydown(function (event) {
+// '?' shows the help if the user is not editing the form.
+// this is here because usually '?' requires 'shift' too, and the
+// switch below is not reached when shift is pressed
+if (event.shiftKey && (event.which == 191) && 
!is_editing(event.target)) {
+help_popup.toggle()
+return false;
+}
 // do nothing if ctrl/alt/shift/meta are pressed
 if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey)
 return true;
-
 // disable the shortcuts while editing form elements (except ESC)
 if (is_editing(event.target)) {
 // ESC - unfocus the form
@@ -90,6 +107,11 @@
 }
 return true;
 }
+// ESC hides the help if the user is not editing
+if (event.keyCode == 27) {
+help_popup.hide();
+return false;
+}
 
 // support two groups of shortcuts for first/prev/next/last/reply:
 //mnemonics: f/p/n/l/r
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread anatoly techtonik

anatoly techtonik  added the comment:

Note that Rietveld version is independent of keyboard layout. See this code 
http://codereview.appspot.com/2055042/diff/20002/static/script.js for example. 
Feel free to reuse everything that's in green.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread anatoly techtonik

anatoly techtonik  added the comment:

It is standard for all Google products, I believe.

--
status: resolved -> chatting

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

How standard is 'Shift+?'?
If it doesn't conflict with browser shortcuts and if it's a common/known 
shortcut I could try to come up with something similar.

--
status: chatting -> resolved

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread anatoly techtonik

anatoly techtonik  added the comment:

I don't think it is resolved. =) Go to http://codereview.appspot.com/ and press 
Shift-?  This is a standard way to document keyboard shortcuts.

--
nosy: +techtonik
status: resolved -> chatting

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

Thanks for the feedback.  I think this can be closed now.
I'll move the instructions to the devguide when I'll fix 
http://bugs.python.org/issue13455

--
status: testing -> resolved

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-11-30 Thread Éric Araujo

Éric Araujo  added the comment:

> These shortcuts use a single key, so they don't need to be combined with 
> ctrl/alt in order to work.
> That means no conflicts with key combinations that the browsers might use.
Good.

> OTOH, it conflicts with the find-as-you-type, but I don't know how used that 
> is.
It does.  I guess only advanced users use find as you type, and they know they 
can use Ctrl-F to start an explicit search.

> The form elements are special-cased, so while you are writing a message in 
> the comment field, the shortcuts
> are disabled.
Good too.

> Is there something else that I'm missing?  If you have interesting links, 
> please share.
I’ll need to dig them up, but the gist of it was that commonly-used browsers 
took up (nearly) all key combinations, so using only numbers for accesskeys is 
recommended.

> I'm also considering making this optional, with a checkbox somewhere to 
> enable/disable it.
Maybe.  (The location would be the user profile I think.)

>> I’ve noticed the new help sub-sidebar; please don’t abuse HTML a elements.
> As I wrote in the source, that's just a temporary workaround.  If the 
> shortcuts work well I'll move their
> documentation in the devguide and remove that sub-menu in a couple of weeks 
> or so.
Did you get the feedback you wanted?  Here it works well (X11, Iceweasel).

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-09 Thread Ezio Melotti

Ezio Melotti  added the comment:

As I wrote in the source, that's just a temporary workaround.  If the shortcuts 
work well I'll move their documentation in the devguide and remove that 
sub-menu in a couple of weeks or so.
I'm also thinking about a context-dependent help system, but there are a few 
problems that need to be solved first.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-08 Thread Éric Araujo

Éric Araujo  added the comment:

I’ve noticed the new help sub-sidebar; please don’t abuse HTML a elements.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-08 Thread Mark Dickinson

Mark Dickinson  added the comment:

Yep, seems to be fixed now.  Thanks!

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-08 Thread Ezio Melotti

Ezio Melotti  added the comment:

r88906 should address this, can you confirm that the problem is fixed now?

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-08 Thread Mark Dickinson

Mark Dickinson  added the comment:

On Safari / OS X, this also seems to block CMD-key combinations:  e.g., CMD-F 
(which I'd normally use to search) just jumps to the first message.  Would it 
be possible either to fix this, or to provide a way to disable the key-bindings?

--
nosy: +mark.dickinson

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-07 Thread Éric Araujo

Éric Araujo  added the comment:

Yay!

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

Indeed.  Should be fixed in r88905.  Thanks for the report!

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-07 Thread Éric Araujo

Éric Araujo  added the comment:

This blocks keybindings like Ctrl-L, which is not acceptable.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

Committed a slightly modified version in r88904.
I also added some help in the sidebar and plan to leave it there for about a 
month (so people will know that there are shortcuts) and then move it to the 
devguide.

--
status: chatting -> testing

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-04 Thread Ezio Melotti

Ezio Melotti  added the comment:

These shortcuts use a single key, so they don't need to be combined with 
ctrl/alt in order to work.  That means no conflicts with key combinations that 
the browsers might use.
OTOH, it conflicts with the find-as-you-type, but I don't know how used that 
is.  The form elements are special-cased, so while you are writing a message in 
the comment field, the shortcuts are disabled.
Is there something else that I'm missing?  If you have interesting links, 
please share.
I'm also considering making this optional, with a checkbox somewhere to 
enable/disable it.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-04 Thread Éric Araujo

Éric Araujo  added the comment:

Are you aware of the issues coming with the use of accesskeys?  If not, I’ll 
dig up the links.

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-03 Thread Ezio Melotti

Ezio Melotti  added the comment:

BTW, this replaces the "end key" script that jumped to the last message.
On the one hand, people will have to switch from 'esc' to 'l', but on the other 
hand it restores the normal behavior of the end key that people expect from the 
browser, so I preferred to remove it (also it doesn't make much difference in 
most of the issues, since they have a short history and the last message will 
still be visible even when the page is scrolled till the end).

--
status: unread -> chatting

___
PSF Meta Tracker 

___
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss


[Tracker-discuss] [issue422] Keyboard shortcuts

2011-10-02 Thread Ezio Melotti

New submission from Ezio Melotti :

The attached patch adds keyboard shortcuts to navigate through the messages to 
the tracker.
There are two different "modes":
* mnemonics:
  f: first message;
  p: previous message;
  n: next message;
  l: last message;
  r: reply (jumps on the comment field and focuses it);

* vim-style:
  h: first message;
  k: previous message;
  j: next message;
  l: last message;
  i: insert-mode (jumps on the comment field and focuses it);
  esc: normal-mode (unfocus the field and re-enables the commands);

It might be nice to add also a command to submit the message, maybe ctrl+enter 
or 's' (but this is a bit risky).

--
assignedto: ezio.melotti
files: issue422.diff
messages: 2257
nosy: eric.araujo, ezio.melotti, r.david.murray
priority: feature
status: unread
title: Keyboard shortcuts

___
PSF Meta Tracker 

___Index: issue.item.js
===
--- issue.item.js   (revision 1)
+++ issue.item.js   (working copy)
@@ -45,21 +45,72 @@
 
 
 $(document).ready(function() {
-/* When the user hits the 'end' key the first time, jump to the last
-   message rather than to the end of the page.  After that restore the
-   normal 'end' behavior. */
-// get the offset to the last message
-var offset = $('table.messages tr th a:last').offset()
+/* Keyboard shortcuts */
+function is_editing(node) {
+// return true if the focus is on a form element
+var element = node.nodeName;
+return ((element == 'TEXTAREA') || (element == 'SELECT') ||
+(element == 'INPUT' && node.type != 'file'));
+}
+function scroll_to(node) {
+// scroll to page to the given node
+window.scrollTo(0, node.offset().top)
+}
+var textarea = $('textarea').first();
+var messages = $('table.messages tr th a:first-child');
+var last_index = messages.length - 1;
+// start from -1 so 'n' sends to the first message at the beginning
+var current = -1;
 $(document).keydown(function (event) {
-var node = event.target.nodeName;
-// 35 == end key. Don't do anything if the focus is on form elements
-if ((event.keyCode == 35) && (node != 'TEXTAREA')
-&& (node != 'INPUT') && (node != 'SELECT')) {
-// jump at the last message and restore the usual behavior
-window.scrollTo(0, offset.top);
-$(document).unbind('keydown')
-return false;
+// disable the shortcuts while editing form elements
+if (is_editing(event.target)) {
+// unfocus the form when the user press ESC
+if (event.keyCode == 27) {
+$(event.target).blur();
+return false;
+}
+return true;
 }
+
+// support two groups of shortcuts for first/prev/next/last/reply:
+//mnemonics: f/p/n/l/r
+//vim-style: h/k/j/l/i
+switch (event.which) {
+// f/h - first
+case 70:
+case 72:
+scroll_to(messages.first());
+current = 0;
+return false;
+// p/k - previous
+case 80:
+case 75:
+if (current <= 0)
+return true;
+current = current - 1;
+scroll_to(messages.eq(current));
+return false;
+// n/j - next
+case 78:
+case 74:
+if (current >= last_index)
+return true;
+current = current + 1;
+scroll_to(messages.eq(current));
+return false;
+// l - last
+case 76:
+scroll_to(messages.last());
+current = last_index;
+return false;
+case 82:
+case 73:
+scroll_to(textarea);
+textarea.focus();
+return false;
+default:
+return true;
+}
 });
 })
 
___
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss