BigW Consortium Gitlab

Commit 61680a2d by Clement Ho

Add selected tagName check for itemClicked

parent d19303cb
......@@ -35,18 +35,20 @@
itemClicked(e) {
const { selected } = e.detail;
if (selected.hasAttribute('data-value')) {
if (selected.tagName === 'LI') {
if (selected.hasAttribute('data-value')) {
this.dismissDropdown();
} else {
const token = selected.querySelector('.js-filter-hint').innerText.trim();
const tag = selected.querySelector('.js-filter-tag').innerText.trim();
} else {
const token = selected.querySelector('.js-filter-hint').innerText.trim();
const tag = selected.querySelector('.js-filter-tag').innerText.trim();
if (tag.length) {
gl.FilteredSearchDropdownManager
.addWordToInput(this.getSelectedTextWithoutEscaping(token));
if (tag.length) {
gl.FilteredSearchDropdownManager
.addWordToInput(this.getSelectedTextWithoutEscaping(token));
}
this.dismissDropdown();
this.dispatchInputEvent();
}
this.dismissDropdown();
this.dispatchInputEvent();
}
}
......
......@@ -28,14 +28,17 @@
itemClicked(e, getValueFunction) {
const { selected } = e.detail;
const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected);
if (!dataValueSet) {
const value = getValueFunction(selected);
gl.FilteredSearchDropdownManager.addWordToInput(value);
}
if (selected.tagName === 'LI') {
const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected);
if (!dataValueSet) {
const value = getValueFunction(selected);
gl.FilteredSearchDropdownManager.addWordToInput(value);
}
this.dismissDropdown();
this.dismissDropdown();
}
}
setAsDropdown() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment