From 5a1dfeec7253149aef07eeacebf05c634cbdb01f Mon Sep 17 00:00:00 2001 From: Max Grossman Date: Thu, 20 Dec 2018 08:47:37 -0500 Subject: [PATCH] open combobox if anywhere on box clicked... ref #5596 --- css/80_app.css | 1 + modules/ui/combobox.js | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/css/80_app.css b/css/80_app.css index 296359eb2..0f6cc4411 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -1906,6 +1906,7 @@ div.combobox { margin-left: -30px; vertical-align: top; cursor: pointer; + pointer-events: none; } [dir='rtl'] .combobox-caret { margin-left: 0; diff --git a/modules/ui/combobox.js b/modules/ui/combobox.js index f8f6f8779..fa3cdbe7f 100644 --- a/modules/ui/combobox.js +++ b/modules/ui/combobox.js @@ -49,9 +49,9 @@ export function uiCombobox(context, klass) { .on('keydown.typeahead', keydown) .on('keyup.typeahead', keyup) .on('input.typeahead', change) + .on('mouseover', mouseover) .each(addCaret); - function addCaret() { var parent = this.parentNode; var sibling = this.nextSibling; @@ -65,22 +65,6 @@ export function uiCombobox(context, klass) { .attr('class', 'combobox-caret') .merge(caret); - caret - .on('mousedown', function () { - // prevent the form element from blurring. it blurs on mousedown - d3_event.stopPropagation(); - d3_event.preventDefault(); - var combo = container.selectAll('.combobox'); - if (combo.empty()) { - input.node().focus(); - fetch('', function() { - show(); - render(); - }); - } else { - hide(); - } - }); } @@ -205,6 +189,22 @@ export function uiCombobox(context, klass) { } + function mouseover() { + // prevent the form element from blurring. it blurs on mousedown + d3_event.stopPropagation(); + d3_event.preventDefault(); + var combo = container.selectAll('.combobox'); + if (combo.empty()) { + input.node().focus(); + fetch('', function() { + show(); + render(); + }); + } else { + hide(); + } + } + function nav(dir) { if (!_suggestions.length) return;