open combobox if anywhere on box clicked...

ref #5596
This commit is contained in:
Max Grossman
2018-12-20 08:47:37 -05:00
parent f478fdbfbd
commit 5a1dfeec72
2 changed files with 18 additions and 17 deletions

View File

@@ -1906,6 +1906,7 @@ div.combobox {
margin-left: -30px;
vertical-align: top;
cursor: pointer;
pointer-events: none;
}
[dir='rtl'] .combobox-caret {
margin-left: 0;

View File

@@ -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;