Skip to main content

Search and Top Navigation

#3523 closed bug (fixed)

Opened October 28, 2008 09:31PM UTC

Closed August 27, 2010 08:50PM UTC

Last modified November 19, 2010 06:26PM UTC

Dialog: onclick return value ignored

Reported by: BrianHV Owned by: scottgonzalez
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>
Attachments (0)
Change History (10)

Changed October 28, 2008 11:42PM UTC by scottgonzalez comment:1

component: ui.coreui.dialog
owner: paulscott.gonzalez

Changed December 31, 2008 08:36PM UTC by scottgonzalez comment:2

milestone: TBD1.6
priority: minormajor

Changed March 08, 2009 02:40PM UTC by rdworth comment:3

milestone: 1.71.8

Changed March 28, 2009 04:13PM UTC by scottgonzalez comment:4

resolution: → worksforme
status: newclosed

This works for me, tested against 1.6rc2 and trunk (1.8pre).

Changed June 22, 2010 06:28PM UTC by jlesueur comment:5

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>

Changed June 22, 2010 06:30PM UTC by jlesueur comment:6

resolution: worksforme
status: closedreopened

Changed August 27, 2010 08:33PM UTC by scottgonzalez comment:7

summary: onclick return value ignored in dialogDialog: onclick return value ignored

Changed August 27, 2010 08:50PM UTC by scottgonzalez comment:8

milestone: 1.81.9
resolution: → fixed
status: reopenedclosed

Fixed in af9864d.

Changed September 10, 2010 05:24PM UTC by scottgonzalez comment:9

milestone: 1.91.8.5

Changed November 19, 2010 06:26PM UTC by Scott González comment:10

Dialog: Don't return true when we don't want to cancel events. Fixes #3523 - Dialog: onclick return value ignored.

Changeset: af9864dcc439bf8d04f4ade248725cc217f66d56