http://www.perlmonks.org?node_id=700681


in reply to Re^2: Better keyboard-driven navigation, any? - yes...
in thread Better keyboard-driven navigation, any? - yes...

I personally believe that since shmem's script has been here publicized, I'd better also publicly copy here my first draft of review on his code. This has taken some time due to my own lazyness and thus may not be completely consistent over time, but I'm confident that it mostly is. I'm copying it here out of my own scratchpad.


I've tried the beast: all in all, I already like it!

Key driven navigation must be turned off whenever a textarea is entered, or a text field. Sadly, there's no uniform id for composition textareas or title textboxes...

Is this the case? If it were, then indeed it would be extremely annoying. But then I've tried e.g. to go to the node consideration text field, both with the hot key and scrolling with the mouse. Then I did not consider the node and move out of it say, with a Tab. And I could start using the keybindings again - seamlessly. Or did I misunderstood anything?

To disable, enter document.onkeypress = ''; in a suitable javascript console (e.g.firebug). Oh.. that reminds me... Firefox only, I guess. Haven't checked IE yet.

I believe that the javascript: pseudo-protocol may do. Again, FF has it: don't know 'bout IE, let alone other browsers.

all sections:
  • p - go to posts / replies section
  • [...]
main section:
  • + - set ++ vote for current post
  • [...]

I'm giving you my impression in terms of UI:

posts:
posts and nodelets:
  • j - down one post/nodelet
  • [...]
posts:
  • r - set focus on reply link
  • [...]
--
If you can't understand the incipit, then please check the IPB Campaign.

Replies are listed 'Best First'.
Re^4: Better keyboard-driven navigation, any? - yes...
by shmem (Chancellor) on Jul 29, 2008 at 15:17 UTC

    It seems like I have to explain a bit better how the navigation is implemented and why so...

    Now to your post - thanks for the feedback! In what follows I'll address some or most of the issues you raised.

    p - go to posts / replies section: ... if possible j should bring to the first reply as well, and k on the first reply should be an alias with m. If possible!

    Hm well - 'm' is just a shortcut to invoke window.scroll(0,0) from any context without loosing the actual context and index. There's currently no key for 'go to root context and clear navigation info'. 'k' on the first item could be made into 'go to current parent context item', but 'j'... well, it seems that hashes in JavaScript don't lose order of definition, for empty collections that could be made into 'invoke first subkey'. I'll look into that.

    update3: fixed. 'j' and 'k' now advance collections. Try on e.g. 'Newest Nodes'.

    - - set -- vote for current post: here, I'm afraid I must tell you of the first actual bug

    Check your version - that should work in $current (at least, "works for me"[tm] ;-) Also '+' and '0'. Update: acknowledged, once you are in the 'p' context you can't vote on the OP any more... update2: fixed. 'R' takes to root context, 'P' to parent/root node of current node. There's been a workaround -just go from posts context to nodelet, and voting works on the op again ;-)

    j - down one post/nodelet: ... and k ended up not moving between posts but between links within a post, and no way to "escape."

    See 'p' - 'j' could default on end of collection 'go to next collection in parent context'. As with "no way to escape" - hitting the access key for the parent context brings back to that. If it doesn't it's a bug ;)

    From there, access links with the <Tab> key:
    Currently all lists accessible with 'l' are a context which you can navigate with the up/down key, i.e. tab browsing is only necessary where the 'l' key doesn't respond.
    t - jump to note composition text area: to be fair, I'm not sure what this is for.

    That's for textareas where you enter text composing a node. If you leave the text area with 'tab', get up with 'm' or scroll about with page-up/page-down, hitting 't' returns to the text area where the cursor was left (initially it's at the bottom, after the signature). After leaving the textarea with <Tab> the focus sits on the 'Preview' button, so don't navigate with the space bar, since that invokes the button.

    r - set focus on reply link: I must say that while for v it is very sensible to only set focus on the vote button, because one may change his mind, I would consider a very good idea to have this key actually open the reply link in a new window/tab and switch to it. If one changes her mind, then she can always close it.

    That would go against all other link navigation, where a link is only focussed. I think that hitting return (or Ctrl-Return) on a link is far better than opening a window per default, only to have to close it afterwards.

    Again, thanks for your feedback, it actually helped me to improve some things and made my hack clearer to myself by composing an answer :-)

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}