From cbd7f1fc984a7027a596becc17fbb5da31ad77dd Mon Sep 17 00:00:00 2001 From: Mathieu Date: Fri, 6 Feb 2015 00:39:09 +0100 Subject: [PATCH] don't stop propagation in dashboard Stopping click propagation should be avoided when used as a hack for something else, as it interacts poorly with the open/close mechanics of Bootstrap menus (amongst others). (more [here](http://css-tricks.com/dangers-stopping-event-propagation/) This code preserves the intended behaviour (toggling the checkbox when clicking on the row, except for the link) without resorting to `stopPropagation()` --- IPython/html/static/tree/js/notebooklist.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index fc56bdb82..b4b191bab 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -336,16 +336,11 @@ define([ checkbox.css('visibility', 'hidden'); } else if (selectable === true) { var that = this; - link.click(function(e) { - e.stopPropagation(); - }); - checkbox.click(function(e) { - e.stopPropagation(); - that._selection_changed(); - }); row.click(function(e) { - e.stopPropagation(); - checkbox.prop('checked', !checkbox.prop('checked')); + // toggle checkbox only if the click doesn't come from the checkbox or the link + if (!$(e.target).is('span[class=item_name]') && !$(e.target).is('input[type=checkbox]')) { + checkbox.prop('checked', !checkbox.prop('checked')); + } that._selection_changed(); }); }