diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index ad1bf2fc89b9b3c33a74d89efd099a0fdeddc7cd..046617fff79a19f120a6d75b75b6d670bdfa102b 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -555,7 +555,19 @@ var canvas_events = (function() {
                 }
             },
             dropdown_menu_mousedown: function(evt) {
-                var select_elem = document.querySelector("#dropdown_list");
+                var select_elem = document.querySelector("#dropdown_list"),
+                    in_dropdown = evt.target;
+                while (in_dropdown) {
+                    if (in_dropdown.id === "dropdown_list") {
+                        break;
+                    }
+                    in_dropdown = in_dropdown.parentNode;
+                }
+                if (in_dropdown &&
+                        evt.pageX - select_elem.offsetLeft >
+                        select_elem.clientWidth) {
+                    return;
+                }
                 if (evt.target.parentNode
                     && evt.target.parentNode.parentNode
                     && evt.target.parentNode.parentNode.id === "dropdown_list") {
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 9b074b430a619ba28202d13124e24c3783f809bb..657ce1218124e401436f2a1ef7d99a61baae8ae1 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -4609,9 +4609,16 @@ function gui_dropdown_activate(cid, obj_tag, tag, current_index, font_size, stat
                 .window.document.querySelector("#dropdown_list");
             // stick the obj_tag in a data field
             select_elem.setAttribute("data-callback", obj_tag);
+            // set the maximum height of the menu to be the remaining
+            // space below the corresponding widget, minus the size of
+            // the scrollbar. (innerHeight includes scrollbar, and
+            // the documentElement's clientHeight (apparently) does not.
             select_elem.style.setProperty("max-height",
                 (patchwin[cid].window.innerHeight -
-                    g.getBoundingClientRect().bottom - 5) + "px"
+                    g.getBoundingClientRect().bottom -
+                    (patchwin[cid].window.innerHeight -
+                    patchwin[cid].window.document.documentElement.clientHeight))
+                    + "px"
             );
             select_elem.style.setProperty("display", "inline");
             select_elem.style.setProperty("left",