View Full Version : Focus the reply message bo


kovidgoyal
02-10-2009, 10:51 PM
I recently switched to using vimperator to do all my browsing since I like to mimize mouse usage. Most of mobileread.com works very well with it, except the reply page. When you click the New Reply button the Message text box on the reply page does not have focus. Which means I have to use an extra 3 keystrokes before I can start typing the reply. Should be an easy fix.

Alexander Turcic
02-11-2009, 12:11 AM
Going to look into it. Btw, never heard of vimperator, but it certainly sounds like a cool extension (for those who love vim!).

kovidgoyal
02-11-2009, 12:43 AM
Thanks, and yeah vimperator is really cool. Raised by browser using efficiency by an order of magnitude.

Alexander Turcic
02-11-2009, 12:55 AM
Wow, installed it and am slightly overwhelmed. ;) Kovid, what would be the shortcut sequence to visit a thread and click on the New Reply button?

kovidgoyal
02-11-2009, 01:36 AM
Yeah, it takes a little getting used to, but once you do, it flies ;)

Press f then look atthe number assigned to New reply and type that number.

Then to focus the reply box press f again and type the number assigned to the reply box. (Note that I've got my reply box set to the simple text box, witht he advanced box, the only way to focus the box is by clicking in it).

Alexander Turcic
02-11-2009, 03:48 AM
Thanks, that worked. :)

Here is what I found out about auto-focusing on an input field on pageload. The Javascript for the reply form is pretty easy to do:

window.onload=function() { document.forms['vbform'].elements['title'].focus(); }

Unfortunately, it breaks the Backspace key to move back in your browsing history. By focusing on a form field you're essentially disabling some fundamental browser functionality.

Kovid, when you are in Reply using vimperator, instead of using an extra 3 keystrokes to focus, you could use the tab key instead. That would reduce it to 1 extra keystroke.

kovidgoyal
02-11-2009, 04:24 AM
Ah well thanks, I'll just have vimperator run the required javascript when I activate the reply

Alexander Turcic
02-11-2009, 04:25 AM
It can do that too? Like greasemonkey?

kovidgoyal
02-11-2009, 04:27 AM
yeah, I don't know if its like greasemonkey (which I've never used), but it has a scripting framework that you can use to run arbitrary javascript on events

Alexander Turcic
02-11-2009, 04:30 AM
Incredible. I should look at it again. ;)