The default bug view has changed. See this FAQ.

[ally] arrow/pgUP/pgDown keys behavior for range

RESOLVED FIXED

Status

Core Graveyard
XForms
RESOLVED FIXED
11 years ago
8 months ago

People

(Reporter: surkov, Assigned: surkov)

Tracking

({fixed1.8.0.12, fixed1.8.1.4})

Trunk
fixed1.8.0.12, fixed1.8.1.4
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

11 years ago
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.
(Assignee)

Comment 1

11 years ago
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.
(Assignee)

Comment 2

11 years ago
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.
(Assignee)

Comment 3

11 years ago
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.
(Assignee)

Comment 4

11 years ago
(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.
(Assignee)

Comment 5

11 years ago
Created attachment 242324 [details] [diff] [review]
patch
Assignee: xforms → surkov.alexander
Status: NEW → ASSIGNED
Attachment #242324 - Flags: review?(aaronr)
(Assignee)

Comment 6

11 years ago
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.
Attachment #242324 - Flags: review?(Olli.Pettay)
(Assignee)

Comment 7

11 years ago
*** Bug 356499 has been marked as a duplicate of this bug. ***

Comment 8

11 years ago
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
Attachment #242324 - Flags: review?(aaronr) → review+
(Assignee)

Comment 9

11 years ago
Created attachment 243747 [details] [diff] [review]
patch2
Attachment #242324 - Attachment is obsolete: true
Attachment #243747 - Flags: review?(Olli.Pettay)
Attachment #242324 - Flags: review?(Olli.Pettay)
(Assignee)

Comment 10

11 years ago
I filed bug 358315 to discuss ability to modify range key behavior.

Updated

11 years ago
Attachment #243747 - Flags: review?(Olli.Pettay) → review+

Comment 11

11 years ago
checked in
(Assignee)

Updated

11 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch

Comment 12

10 years ago
checked into 1.8 branch on 2007-04-12
checked into 1.8.0 branch on 2007-04-16
Keywords: fixed1.8.0.12, fixed1.8.1.4
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.