Last Comment Bug 356498 - [ally] arrow/pgUP/pgDown keys behavior for range
: [ally] arrow/pgUP/pgDown keys behavior for range
Status: RESOLVED FIXED
: fixed1.8.0.12, fixed1.8.1.4
Product: Core
Classification: Components
Component: XForms (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: alexander :surkov
: Stephen Pride
Mentors:
: 356499 (view as bug list)
Depends on:
Blocks: xformsa11y 343525 353738
  Show dependency treegraph
 
Reported: 2006-10-12 17:53 PDT by alexander :surkov
Modified: 2007-04-23 15:44 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (1.79 KB, patch)
2006-10-15 07:21 PDT, alexander :surkov
aaronr: review+
Details | Diff | Review
patch2 (1.91 KB, patch)
2006-10-26 22:22 PDT, alexander :surkov
bugs: review+
Details | Diff | Review

Description alexander :surkov 2006-10-12 17:53:57 PDT
This is spun off from bug 356342 (comments 3, 4 and 5).

Current behavior of up/down arrow and pgUp/pgDown keys is to move slider to right/left. Though xul:scale (and java controls http://java.sun.com/products/jlf/ed1/dg/appendix.htm) acts in vice versa.
Comment 1 alexander :surkov 2006-10-15 06:26:57 PDT
That's how Windows defines keyboard behavior for slider (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc/html/ATG_KeyboardShortcuts.asp):

Arrow keys
Move the slider to the next value. The direction can be reversed by selecting the slider control style LBS_DOWNISLEFT.

PAGE UP and DOWN
Move the slider to next value in specified incremental amount. The direction can be reversed by selecting the slider control style LBS_DOWNISLEFT.
Comment 2 alexander :surkov 2006-10-15 06:33:17 PDT
GNOME 2.2 Desktop Accessibility Guide defines the next behavior (http://docs.sun.com/app/docs/doc/817-1972/6mhlsbe8h?a=view):

left arrow or up arrow
Move the slider left or up by a small amount.

right arrow or down arrow
Move the slider right or down by a small amount. 

Page Up
Move the slider left or up a large amount. 

Page Down
Move the slider right or down a small amount.
Comment 3 alexander :surkov 2006-10-15 06:46:14 PDT
Also there is MS document (http://www.bilbo.com/ms_short.html) that says:

Sliders appear as an indicator on a vertical or horizontal gauge. The
slider both displays and sets a value from a continuous range, such as
speed, brightness, or volume. Use TAB or the appropriate access key to
move the focus to the slider.

Keys: RIGHT ARROW or DOWN ARROW

Action: Selects the next higher setting.

Keys: LEFT ARROW or UP ARROW

Action: Selects the next lower setting.

Keys: HOME or END

Action: Selects the lowest or highest setting.

Keys: PAGE DOWN

Action: Selects a somewhat lower or higher setting depending on the
application. (This is the equivalent of pressing an ARROW key many
times.)

Keys: PAGE UP

Action: Moves in the reverse of the PAGE DOWN.
Comment 4 alexander :surkov 2006-10-15 06:57:21 PDT
(In reply to comment #1)
> That's how Windows defines keyboard behavior for slider
> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc/html/ATG_KeyboardShortcuts.asp):
> 
> Arrow keys
> Move the slider to the next value. The direction can be reversed by selecting
> the slider control style LBS_DOWNISLEFT.
> 
> PAGE UP and DOWN
> Move the slider to next value in specified incremental amount. The direction
> can be reversed by selecting the slider control style LBS_DOWNISLEFT.
> 

MSDN says http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/trackbar/styles.asp

TBS_DOWNISLEFT 
By default, the trackbar control uses down equal to right and up equal to left. Use the TBS_DOWNISLEFT style to reverse the default, making down equal left and up equal right.
Comment 5 alexander :surkov 2006-10-15 07:21:06 PDT
Created attachment 242324 [details] [diff] [review]
patch
Comment 6 alexander :surkov 2006-10-15 07:24:28 PDT
Comment on attachment 242324 [details] [diff] [review]
patch

Also I changed behavior of pgUp/pgDown with http://java.sun.com/products/jlf/ed1/dg/appendix.htm correspondence (value increment/decrement approximately on 20% of scale). Since other docs say nothing concrete.
Comment 7 alexander :surkov 2006-10-15 07:25:36 PDT
*** Bug 356499 has been marked as a duplicate of this bug. ***
Comment 8 aaronr 2006-10-26 18:36:47 PDT
Comment on attachment 242324 [details] [diff] [review]
patch

>Index: extensions/xforms/resources/content/widgets-xhtml.xml
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/xforms/resources/content/widgets-xhtml.xml,v
>retrieving revision 1.10
>diff -u -8 -p -r1.10 widgets-xhtml.xml
>--- extensions/xforms/resources/content/widgets-xhtml.xml	13 Oct 2006 00:53:28 -0000	1.10
>+++ extensions/xforms/resources/content/widgets-xhtml.xml	15 Oct 2006 14:20:14 -0000
>@@ -694,28 +694,32 @@
>         this.ownerDocument.addEventListener("mouseup", handler, true);
>       ]]>
>       </handler>
> 
>       <handler event="keypress">
>         nsIEvent = Components.interfaces.nsIDOMKeyEvent;
>         switch (event.keyCode) {
>           case nsIEvent.DOM_VK_RIGHT:
>-          case nsIEvent.DOM_VK_UP:
>+          case nsIEvent.DOM_VK_DOWN:
>             this.value += this.step;
>             break;
>           case nsIEvent.DOM_VK_LEFT:
>-          case nsIEvent.DOM_VK_DOWN:
>+          case nsIEvent.DOM_VK_UP:
>             this.value -= this.step;
>             break;
>-          case nsIEvent.DOM_VK_PAGE_UP:
>-            this.value += this.step * 2;
>-            break;
>           case nsIEvent.DOM_VK_PAGE_DOWN:
>-            this.value -= this.step * 2;
>+            var delta =
>+              parseInt((this.max - this.min) / 5 / this.step) * this.step;
>+            this.value += delta ? delta : this.step;
>+            break;
>+          case nsIEvent.DOM_VK_PAGE_UP:
>+            var delta =
>+              parseInt((this.max - this.min) / 5 / this.step) * this.step;
>+            this.value -= delta ? delta : this.step;
>             break;

You should probably comment why you are using parseInt((this.max - this.min) / 5 / this.step) * this.step (to ensure delta is at least as large as step and no more than 20% of the selectable value).

Your research is spot on and this should be our default since it is the default for so many other platforms.  But it is still odd to hit the up arrow key and see the value decrease.  It would be nice if we could think of a CSS style that we could use to reverse this if someone wanted that behavior.  That'd be better than forcing the user to make a custom control.

Oh, well.  r=me
Comment 9 alexander :surkov 2006-10-26 22:22:04 PDT
Created attachment 243747 [details] [diff] [review]
patch2
Comment 10 alexander :surkov 2006-10-26 22:26:50 PDT
I filed bug 358315 to discuss ability to modify range key behavior.
Comment 11 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2006-10-27 00:37:31 PDT
checked in
Comment 12 aaronr 2007-04-23 15:44:51 PDT
checked into 1.8 branch on 2007-04-12
checked into 1.8.0 branch on 2007-04-16

Note You need to log in before you can comment on or make changes to this bug.