Closed Bug 257184 Opened 20 years ago Closed 19 years ago

keyboard-modified clicks don't respect onClick return values

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED EXPIRED

People

(Reporter: beau, Assigned: bugzilla)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3

I've defined an onClick event handler for an anchor tag, which wraps around an
image.  Returning false from the handler should cancel the default action
associated with the html element, in this case 'follow link.'  Indeed, this is
the case when a plain left-click is made on the anchor.  However, modifying the
click with a keyboard modifier (shift, alt, ctrl) causes that return value to be
ignored.  The handler will still be called, but the default action occurs no
matter the value returned.

Reproducible: Always
Steps to Reproduce:

1. Save the following source to a file locally.

<HTML>
<BODY>
<A HREF='#' onClick='return false;'>
<IMG SRC='http://www.mozilla.org/images/mlogo.gif'>
</A>
</BODY>
</HTML>

2. load the saved source into Firefox.

3. Click the image without any keyboard modifiers.

3. Hold down shift, alt, or ctrl then click the image again.
Actual Results:  
Actual results depend on the modifier used.

Expected Results:  
Firefox should not follow links, regardless of modifier, when onClick returns false.
Attached file Testcase
Reporter's testcase

What is the expected behaviour here? I get a new window, a new tab, and a save
as for Shift, Ctrl and Alt respectively. In no case does the original page
change in any way (because of return false).
Expected behavior is that nothing happens.  No new tab, no new window, no download.
This bug is nearly the opposite of bug 151142.
For the record, while I'd prefer Firefox went with the defacto standard, I'd be
happy to settle for onAltClick, onShiftClick, and onCtrlClick event handlers. 
This would let buddy in bug 151142 have his expected behavior, but would let
DOM/CSS hackers like me cancel the default events for those specific clicks.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: