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

Add selected tagName check for itemClicked

parent d19303cb
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
itemClicked(e) { itemClicked(e) {
const { selected } = e.detail; const { selected } = e.detail;
if (selected.tagName === 'LI') {
if (selected.hasAttribute('data-value')) { if (selected.hasAttribute('data-value')) {
this.dismissDropdown(); this.dismissDropdown();
} else { } else {
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
this.dispatchInputEvent(); this.dispatchInputEvent();
} }
} }
}
getSelectedTextWithoutEscaping(selectedToken) { getSelectedTextWithoutEscaping(selectedToken) {
const lastWord = this.input.value.split(' ').last(); const lastWord = this.input.value.split(' ').last();
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
itemClicked(e, getValueFunction) { itemClicked(e, getValueFunction) {
const { selected } = e.detail; const { selected } = e.detail;
if (selected.tagName === 'LI') {
const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected); const dataValueSet = gl.DropdownUtils.setDataValueIfSelected(selected);
if (!dataValueSet) { if (!dataValueSet) {
...@@ -37,6 +39,7 @@ ...@@ -37,6 +39,7 @@
this.dismissDropdown(); this.dismissDropdown();
} }
}
setAsDropdown() { setAsDropdown() {
this.input.setAttribute(DATA_DROPDOWN_TRIGGER, `#${this.dropdown.id}`); this.input.setAttribute(DATA_DROPDOWN_TRIGGER, `#${this.dropdown.id}`);
......
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