All users were logged out of Bugzilla on October 13th, 2018

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

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
15 years ago
10 years ago

People

(Reporter: nospam, Unassigned)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

322 bytes, text/html
Details
(Reporter)

Description

15 years ago
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)
(Reporter)

Comment 1

15 years ago
Created attachment 153064 [details]
TestCase
(Reporter)

Comment 2

15 years ago
Confirmed this on Mozilla 1.0 and Mozilla 1.6 and Foxfox 0.9.2 on Knoppix 3.4,
Windows NT4 and Windows 2000.
(Reporter)

Updated

15 years ago
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

Comment 4

14 years ago
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 )

Comment 5

10 years ago
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

Updated

10 years ago
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.