WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
14382
Enter key does not trigger onclick when focus on a button
https://bugs.webkit.org/show_bug.cgi?id=14382
Summary
Enter key does not trigger onclick when focus on a button
Tore B. Krudtaa
Reported
2007-06-25 04:42:51 PDT
Enter key does not trigger onclick when focus on a button Example code below: If I hit enter when focus is on the button in IE, Firefox, Opera then the onclick is triggered.... not so with Safari 3.0.2 beta on windows. As I told in another bug... accesskey does not work on Safari for windows either. Hope this is to be fixed to. <button type="button" onclick="doSomething()" accesskey="D" style="background-color:transparent; border:0px; cursor:pointer;"> <img src="sysimg/date.gif" border="0" title="Find from date" align="absmiddle"> </button>
Attachments
HTML file that illustrates the bug.
(328 bytes, text/html)
2007-07-27 18:00 PDT
,
Soap Blox
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Paul
Comment 1
2007-07-25 01:32:22 PDT
Noticed this too, really a bad thing from an accessibility point of view....
Soap Blox
Comment 2
2007-07-27 16:54:07 PDT
(In reply to
comment #1
)
> Noticed this too, really a bad thing from an accessibility point of view.... >
This is a bug... on windows for sure. Don't have a mac, so I can't debug it myself, but others who do and use my software are complaining. It's as if type="button" on Safari behaves has a type="submit", because it does call the onsubmit event when you hit enter on a type="button".
Soap Blox
Comment 3
2007-07-27 17:01:12 PDT
I guess I'm exposing my ignorance here, but even if it were behaving like a type="button", shouldn't the onclick still fire before the onsubmit? Here's the code I'm using which isn't behaving correctly: <input name="submitType" value="Preview" onclick="preview(this.form)" type="button"> I tab to the button, hit enter, and it goes right to the onsubmit event
andgarden
Comment 4
2007-07-27 17:26:44 PDT
I absolutely see this issue. It appears on Safari Mac, as well. Very annoying for those of us who don't want to switch contexts to enter a comment.
Soap Blox
Comment 5
2007-07-27 18:00:48 PDT
Created
attachment 15713
[details]
HTML file that illustrates the bug. Click on the button, you'll see an alert that says "I am an onclick". Tab to the button, hit "return", you will see an alert that says "I am on onsubmit". Using: Safari for Windows, 3.0.2 (522.13.1)
Dave Hyatt
Comment 6
2007-07-27 21:22:00 PDT
There is no bug on Mac. This is really a Windows port issue. On the Mac, spacebar activates a button, and Enter activates the default button in dialogs. The two are distinct. This is expected behavior to a Mac user. On Windows this is not the case (Enter always activates the focused button, and only activates the default button if another button is not focused).
Soap Blox
Comment 7
2007-07-28 11:28:38 PDT
(In reply to
comment #6
) Wow, on the PC, if i hit the space bar, I got an onclick. Strange! Never knew that. Now I have to figure out how to set the default button. hmmm...
David Kilzer (:ddkilzer)
Comment 8
2007-07-28 13:02:24 PDT
(In reply to
comment #7
)
> Wow, on the PC, if i hit the space bar, I got an onclick. Strange! Never knew > that. Now I have to figure out how to set the default button.
The default submit button is always the first <input type="submit"> within the <form></form> tags, although this may be browser dependent. I don't think there's a way to set the default button, but I think it may be overridden an onsubmit handler (not sure).
Alexey Proskuryakov
Comment 9
2008-01-12 14:02:21 PST
If I'm not mistaken, on TOT both Mac and Windows ports work as this bug report requested. This may mean that we have a bug on Mac now.
Robert Blaut
Comment 10
2008-06-10 23:36:53 PDT
(In reply to
comment #9
)
> If I'm not mistaken, on TOT both Mac and Windows ports work as this bug report > requested. This may mean that we have a bug on Mac now. >
The reported bug was fixed so I think we should close the bug report as fixed and eventually file a new report regarding Mac issue but, personally I don't think that the Mac behavior is buggy. Any other comments on this case?
James Craig
Comment 11
2013-04-15 16:05:05 PDT
Yes, it's expected that non-default buttons on Mac OS X are activated by pressing spacebar, not Return (or Enter). Given that this bug was for Windows, I'm closing it and cloning for the Mac regression.
James Craig
Comment 12
2013-04-15 16:13:49 PDT
That one is 114648
James Craig
Comment 13
2013-04-15 16:13:59 PDT
bug 114648
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug