Closed Bug 44676 Opened 24 years ago Closed 24 years ago

Spacebar to trigger buttons should behave more like win32 native buttons

Categories

(Core :: XUL, defect, P3)

x86
Windows 98
defect

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

Attachments

(2 files)

Build ID: 2000070608

When a button has the focus, you can press spacebar to "press" the button and 
trigger it's default onclick action.  This is also the case in other win32 
apps, but standard behavior is that when the spacebar is down, the button goes 
down (i.e. visually depresses), and when you then release the spacebar, the 
button goes up (i.e. returns to it's normal, non-depressed state).  This subtle 
style effect would be nice to have and would keep consistency with win32.  I'm 
not sure if this is the same behavior in linux (perhaps depending on the window 
manager) or mac, or even if spacebar triggers buttons in those platforms.
ok, button man
Assignee: trudelle → evaughan
The button must go to :active when space is pressed. How do we do that? Any 
ideas?
Status: NEW → ASSIGNED
hmm..not sure...ben or john, any ideas?
Not making this train. mass-moving all evaughan non-nsbeta3+ bugs to Future 
milestone

Target Milestone: --- → Future
Strictly speaking this applies to check boxes and radio buttons as well: holding
down space is equivalent to holding down the left mouse button.

And if you want to be really picky, the mouse takes precedence over the space
key - if both are down at once then the mouse hover rules apply.
*** Bug 57233 has been marked as a duplicate of this bug. ***
To Hyatt
Assignee: evaughan → hyatt
Status: ASSIGNED → NEW
Taking...
Assignee: hyatt → blakeross
cc'ing saari for review.
Status: NEW → ASSIGNED
Did you confirm that this works okay with the HTML file picker control?
Specifically what happens when you type space in the textfield part of that
control? 
I can only test this on Windows at the moment, which uses the native file picker.
No, not the file picker dialog, the widget that shows up in html that is a
textfield and a button that are associated.
Oh.  Yeah, it works fine.  (This is XUL only, btw...)
Okay, scc would point out that you should prefer NS_STATIC_CAST and friends
instead of straight C casts, but otherwise, it looks OK to me. r=saari
Okay, will do.  Thanks.  cc'ing alec for sr
I don't want to sr= event stuff - it's just too scary for my shallow depth of
knowledge in that area, sorry :(
how about hyatt and/or saari?
k.  cc'ing hyatt for sr
You're putting the button into :hover on a keypress, which I don't know that you
can really get away with.  You'll destroy the :hover feedback that the mouse is
supplying.  It looks like you don't clear :hover either after stealing it away
from the mouse.

Hyatt: Fixed point two in my tree (about not clearing :hover).  I understand 
point one, but I'm not quite sure what to do about it.  How else can we achieve 
the same effect?  Any ideas?  I can't imagine it causing any problems, but it 
is indeed awkward.
...The problem, of course, being that buttons, etc. only (correctly) have the 
right style rules for :hover:active, not :active.
One last thing, it doesn't really destroy the mouse :hover feedback, although 
this may actually be the problem (if you hold down spacebar while moving the 
cursor over other widgets, the button will pop in and out as it passes in and 
out of :hover...I was planning on discussing how to fix this with saari in a 
separate bug after this, since it's the 1% case).

Anyways, I'd really like to see this fixed, so suggestions welcome. 
I think it's good enough this way, since most of the time the user isn't moving
the mouse while they hit the keys.

sr=hyatt
Fix checked in.

Thanks hyatt, sorry for all the spam from this tonight.  New bug coming to 
handle the cursor case.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Just to be picky, the Win32 behaviour is to ignore the keyboard when the mouse
button is pressed, i.e. 'hold space, button down, release space, drag mouse out,
button up' does not trigger the button. If space has been held when you button
down, drag out and button up then the button reactivates. Not that the average
user uses the mouse and keyboard quite so simultaneously...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: