@kolkrabbi/kol-component 0.281.0 → 0.282.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -138,11 +138,13 @@ export default function SearchInput({
|
|
|
138
138
|
|
|
139
139
|
/* Escape closes, and so does clicking away — a field that can only be closed
|
|
140
140
|
* by emptying it and blurring is a trap, and this one had neither wired. The
|
|
141
|
-
* listener only exists while open.
|
|
141
|
+
* listener only exists while open. A click away closes an EMPTY field only: with a query in it,
|
|
142
|
+
* the results below are what you are clicking (the icon catalog lost its filter on every tile
|
|
143
|
+
* click, 2026-10-20), so the query stays until Escape or the clear. */
|
|
142
144
|
const shellRef = useRef(null)
|
|
143
145
|
useEffect(() => {
|
|
144
146
|
if (!expanding || !isOpen) return undefined
|
|
145
|
-
const away = (e) => { if (shellRef.current && !shellRef.current.contains(e.target)) setOpen(false) }
|
|
147
|
+
const away = (e) => { if (shellRef.current && !shellRef.current.contains(e.target) && !inputRef.current?.value) setOpen(false) }
|
|
146
148
|
const esc = (e) => { if (e.key === 'Escape') setOpen(false) }
|
|
147
149
|
document.addEventListener('mousedown', away)
|
|
148
150
|
document.addEventListener('keydown', esc)
|