[Rails] Can rails make use of accesskeys?

Justin Forder justin at justinforder.me.uk
Mon Jan 2 11:12:22 GMT 2006


Bruce Balmer wrote:

> I updated to locomotive 1.0  I have no idea if that is what solved  
> the problem but things are working now with access keys for me.  I  
> also wrapped my :action=>goodbye in braces (which I had not done  
> before) and that may have been it. 

Make one change at a time, and test at each step, so that you can be 
clear on which change gave what result. The braces are the critical 
thing - as Jarkko pointed out, there are two hash arguments, and unless 
you put those braces in, all the key/value pairs will be going into the 
first hash.

I agree with Jarkko that the clearest style is with braces around both 
hashes - as in my second example earlier:

   <%= link_to 'Back', {:action => 'list'}, {:accesskey => "b"} %>

It's a pity that the examples in the RDoc don't follow that style.

I asked earlier if you were seeing the accesskey attribute when you did 
"View Source" in the browser. Try that again, with and without the 
braces, and note the difference.

By the way, you could have tested Safari's handling of the accesskey 
attribute using static HTML files, rather than compounding your 
uncertainties regarding Safari with your uncertainties about the link_to 
helper in Rails.

> Thanks to all that helped and  
> particularly Justin, who may have provided the breakthrough.

You are welcome!

   Justin


More information about the Rails mailing list