Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#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 Scott González

Component: ui.coreui.dialog
Owner: changed from paul to scott.gonzalez

comment:2 Changed 14 years ago by Scott González

Milestone: TBD1.6
Priority: minormajor

comment:3 Changed 14 years ago by rdworth

Milestone: 1.71.8

comment:4 Changed 14 years ago by Scott González

Resolution: worksforme
Status: newclosed

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

comment:5 Changed 13 years ago by jlesueur

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 jlesueur

Resolution: worksforme
Status: closedreopened

comment:7 Changed 13 years ago by Scott González

Summary: onclick return value ignored in dialogDialog: onclick return value ignored

comment:8 Changed 13 years ago by Scott González

Milestone: 1.81.9
Resolution: fixed
Status: reopenedclosed

Fixed in af9864d.

comment:9 Changed 13 years ago by Scott González

Milestone: 1.91.8.5

comment:10 Changed 12 years ago by Scott González

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

Changeset: af9864dcc439bf8d04f4ade248725cc217f66d56

Note: See TracTickets for help on using tickets.