← Back to team overview

launchpad-dev team mailing list archive

Adding keyboard shortcuts in Launchpad

 

Hi,

I start working on implementing keyboard shortcuts for Launchpad
Translation, main translation page and I am asking for opinions/ideas
regarding some outstanding issues.

I hope that I am not bothering you with them and some of you will find
them useful :)

-----------

My first attempts was to implement them using HTML ACCESKEY, but the
following drawbacks exists:
 * inconsistent ACCESSKEY implementation in webbrowser ( Alt vs Alt
+Shift vs Ctrl vs Shift+Esc, focus vs activate the element) \
 * hard to associate YUI3 methods

So I ended up having a mix of ACCESSKEY and YUI3 event-key.
Then I went for a YUI3 event-key implementation and this offers a
consistent key association across all browsers and it also allow
unobtrusive JavaScript.

The next step was to find keyboard combinations that will not interfere
with window manager / web browser.

Alt+KEY, Ctrl+KEY and Ctrl+Shift+KEY will overlap with Firefox and
Chromium shortcuts.
Ctrl+Alt+KEY and Alt+Shift+KEY will overlap with window managers.
Simple KEY shortcuts can not be used as on the translation page users
will always have a focused INPUT/TEXTAREA field.
If you don't have text field, you are lucky with simple key shortcuts.

I went for Alt+Shift+KEY as it looks like it has less overlapping with
window managers.
In Chromium/Epiphany/Webkit and Firefox Alt+Shift+Key is also used for
HTML ACCESSKEY and I thought the browsers will not use that keybinding
space.

Chromium/Webkit is fine, but I was wrong with Firefox as when there is
no HTML ACCESSKEY for that KEY on the page, Firefox will treat a SHIFT
+ALT+KEY as a plain ALT+KEY, popping up the Menu and blocking the YUI3
event.
Also in Windows, Shift+Alt is used by default to changed the keyboard
layout.

Another option is to use Ctrl+KEY as browsers will first call YUI3
events. This will guarantee that YUI3 events are always called, but has
a major drawback of messing with users keybindings. Also IE7 will not
allow to overwrite Ctrl+P, Ctrl+F and Ctrl+O.

As a workaround, you can add a dummy <a acceskey=KEY> for _each_
keybinding implemented using YUI3. In this case Firefox will not pop up
the menu and will call the YUI3 event for SHIFT+ALT+Key.

This is bug:
https://bugs.edge.launchpad.net/rosetta/+bug/591352

Do you know how we can have a consistent keyboard shortcut
implementation in Launchpad?

------

Finally, if we solve the method invocation problem there is another
issue: hinting / documenting used keyboard shortcuts.

We can add a list of keybindings on help.lp.net/Translations but it
would be nice to automatically inform or hint translators about the
available translations.

We can underline the letter, or put them KEY in brackets, but not all
actions have an associated text.
Exemple: Shift+Alt+C - copy original text.

It looks like most webapps don't provide a visual clue for their
shortcuts, but rather document them on the help page.

This is bug:
https://bugs.edge.launchpad.net/rosetta/+bug/591358

Do you know how can we implement such clues in Launchpad?

Many thanks!

-- 
Adi Roiban




Follow ups