Code review comment for lp:~adiroiban/launchpad/bug-359180

Revision history for this message
Adi Roiban (adiroiban) wrote :

= Bug 359180 =
Would be useful if the First - Previous - Next - Last link in the translation interface had a keyboard shortcut for fast accessing them. Don't need to be visible, but at least documented somewhere.

Maybe even the Save & Continue button.

== Pre-implementation notes ==

Talking with Danilo we agreed not to use tabindex as it may disturb screen readers.

HTML Accesskeys were used for links, while YUI3 key-event here used for navigation between input fields and copying the original text.

== Implementation details ==

Shift+Alt+a - First (using accesskey)
Shift+Alt+n - Next (using accesskey)
Shift+Alt+p - Previous (using accesskey)
Shift+Alt+l - Last (using accesskey)
Shift+Alt+S - Save and continue (using accesskey)
Shift+Alt+Down - Next field (using YUI3 key-event)
Shift+Alt+Up - Previous field (using YUI3 key-event)
Shift+Alt+C - Copy original text (both singular and plural) (using YUI3 key-event)

First field is autofocused.

I went for Shift+Alt as they are used for Acceskey, and I assume browsers will try to reserve them.

Once keybindings are agreed they should be documented on help.launchpad.net

Accesskeys were tested on Epiphany and Chromium.
Wikipedia says that Accesskeys in Firefox are enabled with Shift+Alt but I was not able to activate them on my Firefox.
http://en.wikipedia.org/wiki/Access_key

-----

The legacy JS code from canonical/launchpad/icing/build/lp/lp.js and from pofile-tranlate.pt was moved to javascript/translations/pofile.js.

Those functions from lp.js was rewritten using YUI3. Maybe we can no delete them from lp.js.

== Tests ==
I was not able to produce a reasonable windmill test since it is not trivial to find the current focused node or to see if a node is focused.
This requires adding onFocus and onBlur trigger for all DOM nodes.

== Demo and Q/A ==
Log in as admin or as a person with rights on adding translations to a pofile.

Go to a pofile translate page:
https://translations.launchpad.dev/ubuntu/hoary/+source/evolution/+pots/evolution-2.2/es/+translate?start=0

The first field should have focus and you can start translating right away.

Adding a new translation should automatically select the radio button in front of it.

Pressing Alt + Shift + C will copy the original text. Current text will be discarded.

Pressing Alt + Shift + Down will set the focus to the next input field. Last field is Save and Continue button.

Pressing Alt + Shift + Up will set the focus to the previous input field. Nothing will happen when pressing on the first field.

Pressing Alt + Shift + A from anywhere in the page will point the browser to the fist page in the batch navigation.

Pressing Alt + Shift + L from anywhere in the page will point the browser to the last page in the batch navigation.

Pressing Alt + Shift + N from anywhere in the page will point the browser to the next page in the batch navigation.

Pressing Alt + Shift + P from anywhere in the page will point the browser to the previous page in the batch navigation.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/javascript/translations/pofile.js

== JSLint notices ==
No handlers could be found for logger "bzr"
jslint: No problem found in '/home/adi/launchpad/lp-branches/bug-359180/lib/canonical/launchpad/javascript/translations/pofile.js'.

jslint: 1 file to lint.

« Back to merge proposal