Closed Bug 251214 Opened 20 years ago Closed 16 years ago

preventDefault doesn't work with modifiers (e.g. ctrl, alt, shift )

Categories

(Core :: DOM: Events, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: nospam, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2
Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2

preventDefault() should stop links from opening when they are clicked on. It
doesn't work if you hold down ctrl alt or shift. Each one of these still fires
off the apropriate behaivour ('open new tab'. 'save link', or 'open new window') 

Reproducible: Always
Steps to Reproduce:
1.Load test page
2.Hold down a modifier (ctrl, alt and/or shift)
3.Click on the link

Actual Results:  
click (dialog box + nothing)
ctrl+click (dialog box + A new page loads in a tab)
alt+click (dialog box + Save page dialog opens)
shift+click (dialog box + A new page loads in a new window)

Expected Results:  
click (dialog box + nothing)
ctrl+click (dialog box + nothing)
alt+click (dialog box + nothing)
shift+click (dialog box + nothing)
Attached file TestCase
Confirmed this on Mozilla 1.0 and Mozilla 1.6 and Foxfox 0.9.2 on Knoppix 3.4,
Windows NT4 and Windows 2000.
Component: Event Handling → DOM: Events
Confirmed with:
Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10
I see this also on LInux 2004093006.
Depending on your site you can use e.stopPropagation() as a work around.
Also Alt+click does not fire an event it seems.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: preventDefault doesn't swork with modifiers (e.g. ctrl, alt, shift ) → preventDefault doesn't work with modifiers (e.g. ctrl, alt, shift )
Can someone still reproduce this?
Works for me, using:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2pre) Gecko/20080820035100 Minefield/3.1a2pre
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: