diff --git a/src/components/inputhints/index.js b/src/components/inputhints/index.js index 08d15a45d..76e5ffcc2 100644 --- a/src/components/inputhints/index.js +++ b/src/components/inputhints/index.js @@ -70,7 +70,10 @@ export default function inputhints($input, hints, onSelect) { const action = $el.getAttribute("action"); if (action !== "hint") return; const value = $el.getAttribute("value"); - if (!value) return; + if (!value) { + onblur(); + return; + } $input.value = $el.textContent; if (onSelect) onSelect(value); preventUpdate = false; @@ -304,14 +307,19 @@ export default function inputhints($input, hints, onSelect) { const end = offset + LIMIT; const list = hints.slice(offset, end); let scrollTop = $ul.scrollTop; - if (!list.length) return; + //if (!list.length) return; $ul.remove(); - if (!page) { - scrollTop = 0; - $ul.content = list.map((hint) => ); + + if (!list.length) { + $ul.content = []; } else { - $ul.append(...list.map((hint) => )); + if (!page) { + scrollTop = 0; + $ul.content = list.map((hint) => ); + } else { + $ul.append(...list.map((hint) => )); + } } app.append($ul); $ul.scrollTop = scrollTop; diff --git a/src/components/inputhints/style.scss b/src/components/inputhints/style.scss index 6f07606d8..a4deb7121 100644 --- a/src/components/inputhints/style.scss +++ b/src/components/inputhints/style.scss @@ -1,4 +1,4 @@ -@import '../../styles/mixins.scss'; +@import "../../styles/mixins.scss"; #hints { position: fixed; @@ -29,8 +29,8 @@ border-radius: 4px; } - [data-action='hint'], - [action='hint'] { + [data-action="hint"], + [action="hint"] { font-size: 0.9rem; min-height: 30px; height: fit-content; @@ -88,4 +88,4 @@ &:empty { display: none; } -} \ No newline at end of file +}