Summary: | Enter key does not trigger onclick when focus on a button | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Tore B. Krudtaa <krudtaa> | ||||
Component: | Accessibility | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED WORKSFORME | ||||||
Severity: | Normal | CC: | ap, aroben, jcraig, pgbakker, webkit | ||||
Priority: | P2 | Keywords: | PlatformOnly | ||||
Version: | 523.x (Safari 3) | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Attachments: |
|
Description
Tore B. Krudtaa
2007-06-25 04:42:51 PDT
Noticed this too, really a bad thing from an accessibility point of view.... (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". 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 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. 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)
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). (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... (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). 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. (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? 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. That one is 114648 |