#3523 closed bug (fixed)
Dialog: onclick return value ignored
Reported by: | BrianHV | Owned by: | Scott González |
---|---|---|---|
Priority: | major | Milestone: | 1.8.5 |
Component: | ui.dialog | Version: | 1.6rc2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The onclick return value on a link is being overridden when that link is added to a modal dialog.
In the following code sample, clicking the first link correctly does nothing when it's not in a dialog. Clicking the second link places the first into a dialog, at which point the first link causes navigation despite the false return value.
This bug was discovered in 1.6rc2 and confirmed to still be present in trunk.
<html> <body> <script type="text/javascript" language="javascript" src="jquery-1.2.6.js"></script> <script type="text/javascript" language="javascript" src="ui/ui.core.js"></script> <script type="text/javascript" language="javascript" src="ui/ui.dialog.js"></script> <p><a href="nowhere.html" id="brokenlink" onclick="return false;">This link shouldn't do anything, but when it's in a dialog it does.</a></p> <p><a href="#" onclick="$('#brokenlink').dialog({modal: true});">Open dialog</a></p> </body> </html>
Change History (10)
comment:1 Changed 14 years ago by
Component: | ui.core → ui.dialog |
---|---|
Owner: | changed from paul to scott.gonzalez |
comment:2 Changed 14 years ago by
Milestone: | TBD → 1.6 |
---|---|
Priority: | minor → major |
comment:3 Changed 14 years ago by
Milestone: | 1.7 → 1.8 |
---|
comment:4 Changed 14 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:5 Changed 13 years ago by
This behavior is browser-specific, IE8 still behaves this way with jquery-ui 1.8. This is the slightly modified(to use newer versions of jquery) code to reproduce on IE8
<html> <body> <script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryu i/1.8/themes/base/jquery-ui.css" rel="stylesheet" /> <p><a href="nowhere.html" id="brokenlink" onclick="return false;">This link shouldn't do anything, but when it's in a dialog it does.</a></p> <p><a href="#" onclick="$('#brokenlink').dialog({modal: true});">Open dialog</a></p> </body> </html>
comment:6 Changed 13 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
comment:7 Changed 13 years ago by
Summary: | onclick return value ignored in dialog → Dialog: onclick return value ignored |
---|
comment:8 Changed 13 years ago by
Milestone: | 1.8 → 1.9 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Fixed in af9864d.
comment:9 Changed 13 years ago by
Milestone: | 1.9 → 1.8.5 |
---|
comment:10 Changed 12 years ago by
Dialog: Don't return true when we don't want to cancel events. Fixes #3523 - Dialog: onclick return value ignored.
Changeset: af9864dcc439bf8d04f4ade248725cc217f66d56
This works for me, tested against 1.6rc2 and trunk (1.8pre).