NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item11383 for general documentation changes for release 1.1.5. Use Item9693 for docu changes for release 2.0.

Item2638: Edit/Attach keyboard shortcuts not working in Firefox

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Low Confirmed Extension PatternSkin Main.ArthurClemens
The AccessKeys for Edit & Attach do not work correctly in Firefox.

This problem has been observed with Firefox 3.0.x under Windows and Firefox 3.5.x on Mac OS X. It appears to pre-date Foswiki, as I have noticed it on my older T* installations.

The accesskey for Edit & Attach is defined in two places -- on both the bottom bar and the top-right bar. If you press the attach access key repeatedly, you will notice that it cycles between the top and bottom of the page. If you press enter after hitting the access key, it follows the link. The same thing happens with the edit access key.

The authors of Firefox may have done this to allow people to still use the keyboard if, say, the webmaster has defined an accesskey twice which does two different things. In our case, both accesskeys perform the same action, it is just annoying (and non-intuitive) to have to press enter.

A quick experiment confirmed that, if I simply removed the Edit/Attach buttons on the top toolbar, the problem goes away. If you change the following line in view.pattern.tmpl, you lose the Edit/Attach buttons but now the Edit/Attach access keys work as expected:

-%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{"activatable_attach"}%%TMPL:END%
+%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:END%

Of course, I don't really want to lose my Edit/Attach buttons, but the current template definition did not seem to give me an easy way to preserve the Edit/Attach buttons in both places and only define the accesskey twice.

I came up with the following solution:

  • Edit templates/viewtopicactionbuttons.tmpl
  • Copy the definitions for edit_topic_link and attach_link, calling the new ones edit_topic_link_noaccesskey and attach_link_noaccesskey, and remove the accesskey definition
  • Due to the way that these templates are used, there are many other places that need to reference the new templates:
    • edit_or_create — create a new version that references edit_topic_link_noaccesskey
    • activatable_edit_or_create — create a new version that references edit_or_create_noaccesskey
    • action_activatable_edit_or_create — create a new version that references activatable_edit_or_create_noaccesskey
    • active_attach — create a new version that references attach_link_noaccesskey
    • activatable_attach — create a new version that references active_attach_noaccesskey
  • Edit templates/view.pattern.tmpl
  • Modify the top:toolbarbuttons template to reference activatable_edit_or_create_noaccesskey and activatable_attach_noaccesskey

Obviously this is not a great solution. Perhaps somebody else (who has more experience with the templates) could come up with a cleaner way of fixing this and work it into the next release? smile

Here is a diff of my changes to these two files. I have tested this with Firefox 3.0.11 running under Windows and Firefox 3.5.3 on Mac OS X.

# diff -u viewtopicactionbuttons.tmpl.orig viewtopicactionbuttons.tmpl | egrep -e "^(\+|\-)"
--- viewtopicactionbuttons.tmpl.orig    2010-01-13 08:54:56.000000000 -0800
+++ viewtopicactionbuttons.tmpl 2010-01-13 08:33:03.000000000 -0800
+%TMPL:DEF{"edit_topic_link_noaccesskey"}%<span class="foswikiRequiresChangePermission"><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%%IF{"context TinyMCEPluginEnabled" then="" else=";nowysiwyg=1"}%' rel='nofollow' %MAKETEXT{"title='Edit this topic text'>&Edit"}%</a></span>%TMPL:END%
+
+%TMPL:DEF{"attach_link_noaccesskey"}%<span class="foswikiRequiresChangePermission"><a href='%SCRIPTURLPATH{"attach"}%/%WEB%/%TOPIC%' rel='nofollow' %MAKETEXT{"title='Attach an image or document to this topic'>&Attach"}%</a></span>%TMPL:END%
+
+%TMPL:DEF{"edit_or_create_noaccesskey"}%%TMPL:P{context="new_topic" then="create_topic_link" else="edit_topic_link_noaccesskey"}%%TMPL:END%
+
+%TMPL:DEF{"action_activatable_edit_or_create_noaccesskey"}%%TMPL:P{"activatable_edit_or_create_noaccesskey"}%%TMPL:P{"sep"}%%TMPL:END%
+
+%TMPL:DEF{"activatable_edit_or_create_noaccesskey"}%%TMPL:P{context="inactive" then="inactive_edit_with_view_topic" else="edit_or_create_noaccesskey"}%%TMPL:END%
+
+%TMPL:DEF{"active_attach_noaccesskey"}%%TMPL:P{"attach_link_noaccesskey"}%%TMPL:END%
+
+%TMPL:DEF{"activatable_attach_noaccesskey"}%%TMPL:P{context="inactive" then="inactive_attach" else="active_attach_noaccesskey"}%%TMPL:END%
+


# diff -u view.pattern.tmpl.orig view.pattern.tmpl | egrep -e "^(\+|\-)"
--- view.pattern.tmpl.orig      2010-01-13 08:33:16.000000000 -0800
+++ view.pattern.tmpl   2010-01-13 08:33:36.000000000 -0800
-%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{"activatable_attach"}%%TMPL:END%
+%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create_noaccesskey"}%%TMPL:P{"activatable_attach_noaccesskey"}%%TMPL:END%


Apparently there are problems in Safari with access keys not working either, See Item9038

-- PaulHarvey - 20 May 2010

ItemTemplate edit

Summary Edit/Attach keyboard shortcuts not working in Firefox
ReportedBy ChrisTracy
Codebase 1.0.8, trunk
SVN Range
AppliesTo Extension
Component PatternSkin
Priority Low
CurrentState Confirmed
WaitingFor ArthurClemens
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r3 - 20 May 2010 - 03:54:51 - PaulHarvey
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads