Closed Bug 68568 Opened 24 years ago Closed 24 years ago

Onclick event handler on <A> tag not activated by the return key

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: h.leininger, Assigned: joki)

References

()

Details

(Keywords: access, Whiteboard: fixinhand)

Attachments

(2 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 0.8) Gecko/20010211 BuildID: 2001021108 The homepage contains a login form. The login data can only be sent by mouse, not by the keyboard. Reproducible: Always Steps to Reproduce: http://www.bankaustria.com type something into Verfüger and PIN hit TAB to get the marquee around login hit RETURN Actual Results: nothing happens Expected Results: Forms data should be transmitted (as in IE 5, Netscape 4.76) happens also in Windows 98 code extract: <tr align = "center"> <td class = "startlogin" colspan = "2"> <a href = "#" onclick="return submitLoginData();" onMouseOver="status='Login';return true;" onMouseOut="status='';return true;"><font color = "FF0000">Login</font></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href = "#" onclick="join();" onMouseOver="status='Beitreten';return true;" onMouseOut="status='';return true;"><font color = "FF0000">Beitreten</font></a></td> </tr>
Setting this to OS=all because I'm seeing this on Linux, too (build 2001-02-11-09). it seems we don't handle the onClick when pressing the 'enter' key. We usually follow links with keyboard navigation this way (common links where we just have to load the href="" URL). Probably we should follow onClick, too. Not sure if this is right component because of that... I think this is not really a from submission, but a keyboard navigation bug.
OS: Windows 2000 → All
Confirming this with user agent: Mozilla/5.0 (Windows; U; Win98; en-US; 0.8) Gecko/20010210 build: 2001021008 This might be a duplicate of bug 67948. 67948 is dealing with a submit button, but both bugs have the onMouseOver returning true in common.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This has nothing to do with form submition. In Nav 4.x and IE it seems that hitting enter activates the onclick event handler. Netscape 6 doesnt. Moving to event handling. Changing summary.
Component: Form Submission → Event Handling
Summary: Forms data cannot be sent by hitting the return key → Onclick event handler on <A> tag not activated by the return key
Yes, sorry for the confusion with 67948. I'm submitting a test case below that shows the onclick is not handled by pressing enter instead the href of the link is followed.
The <A> issues are core layout - reassigning
Assignee: rods → attinasi
The problem seems to be in nsGenericHTMLElement::HandleDOMEventForAnchors where it purposefully handles the Enter the same as a click (see comment '//Click or return Key'). I believe that the code in nsGenericHTMLElement::HandleDOMEvent needs to change to fire the onClick hander for <enter> too, but then there needs to be some feedback to HandleDOMEventForAnchors to tell it NOT to follow the link. I see jst's name all over this code, so sending it his way (I have no clue about these event handling bubbling/capturing/retargeting issues). CC'ing self in hopes of obtaining a clue.
Assignee: attinasi → jst
Reassigning to the owner of the DOM event code.
Assignee: jst → joki
Hardware: PC → All
Probably a relatively easy fix. Assigning to 0.9.1, though I hate to say it may get pushed out of that.
Target Milestone: --- → mozilla0.9.1
Attached patch Proposed patchSplinter Review
Around line 1160, there's an unnecessary if statement: + if (aEvent->message == NS_MOUSE_LEFT_CLICK) { Right? We're inside a case NS_MOUSE_LEFT_CLICK: so there's no need to check this any more. Remove that check and you have sr=jst
I guess it's good to fix this for the critical (form submission) example given, but it still seems strange to me; onclick by definition is a mouse-only event.
Just because a bunch of non-accessibility-savvy LiveScript inventors decided to call it `onClick' (:-) doesn't mean it shouldn't also apply to trackballs. Or keyboards. Or speech interfaces. Or ... In other words, this is an accessibility issue. Absolutely you should be able to trigger onClick with the keyboard.
Keywords: access
Does W3 dictate the meaning of onclick [for DOM]?
Component: Event Handling → DOM Events
Status: NEW → ASSIGNED
Whiteboard: fixinhand
r=saari for backward compatiblity
Fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verifying on build 2001-05-04-04-trunk windows 98
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: