dev(webui): add forceShowOptions prop to Selector for debugging purposes

This commit is contained in:
Tomáš Mládek 2024-07-14 11:06:49 +02:00
parent dddc16ea69
commit 8fda6fba65

View file

@ -108,6 +108,7 @@
export let placeholder = '';
export let disabled = false;
export let keepFocusOnSet = false;
export let forceShowOptions = false;
export let initial: SelectorValue | undefined = undefined;
let inputValue = '';
@ -449,7 +450,8 @@
let inputFocused = false;
let hover = false; // otherwise clicking makes options disappear faster than it can emit a set
$: visible =
(inputFocused || hover || optionFocusIndex > -1) && Boolean(options.length || updating);
((inputFocused || hover || optionFocusIndex > -1) && Boolean(options.length || updating)) ||
forceShowOptions;
$: dispatch('focus', inputFocused || hover || optionFocusIndex > -1);
$: dbg('%o focus = %s, hover = %s, visible = %s', selectorEl, inputFocused, hover, visible);