Commit 61680a2d authored by Clement Ho's avatar Clement Ho

Add selected tagName check for itemClicked

parent d19303cb
...@@ -35,18 +35,20 @@ ...@@ -35,18 +35,20 @@
itemClicked(e) { itemClicked(e) {
const { selected } = e.detail; const { selected } = e.detail;
if (selected.hasAttribute('data-value')) { if (selected.tagName === 'LI') {
if (selected.hasAttribute('data-value')) {
this.dismissDropdown(); this.dismissDropdown();
} else { } else {
const token = selected.querySelector('.js-filter-hint').innerText.trim(); const token = selected.querySelector('.js-filter-hint').innerText.trim();
const tag = selected.querySelector('.js-filter-tag').innerText.trim(); const tag = selected.querySelector('.js-filter-tag').innerText.trim();
if (tag.length) { if (tag.length) {
gl.FilteredSearchDropdownManager gl.FilteredSearchDropdownManager
.addWordToInput(this.getSelectedTextWithoutEscaping(token)); .addWordToInput(this.getSelectedTextWithoutEscaping(token));
}
this.dismissDropdown();
this.dispatchInputEvent();
} }
this.dismissDropdown();
this.dispatchInputEvent();
} }
} }
......
...@@ -28,14 +28,17 @@ ...@@ -28,14 +28,17 @@
itemClicked(e, getValueFunction) { itemClicked(e, getValueFunction) {
const { selected } = e.detail; const { selected } = e.detail;
const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected);
if (!dataValueSet) { if (selected.tagName === 'LI') {
const value = getValueFunction(selected); const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected);
gl.FilteredSearchDropdownManager.addWordToInput(value);
} if (!dataValueSet) {
const value = getValueFunction(selected);
gl.FilteredSearchDropdownManager.addWordToInput(value);
}
this.dismissDropdown(); this.dismissDropdown();
}
} }
setAsDropdown() { 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