wip
This commit is contained in:
parent
4d79589903
commit
9ef34359d8
@ -166,16 +166,18 @@
|
|||||||
updateVisibleItems();
|
updateVisibleItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize container size observer and autofocus
|
// Initialize container size observer and autofocus fallback
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (container) {
|
if (container) {
|
||||||
const resizeObserver = new ResizeObserver(updateVisibleCount);
|
const resizeObserver = new ResizeObserver(updateVisibleCount);
|
||||||
resizeObserver.observe(container);
|
resizeObserver.observe(container);
|
||||||
if (autofocus && inputElement) {
|
|
||||||
inputElement.focus();
|
|
||||||
}
|
|
||||||
return () => resizeObserver.disconnect();
|
return () => resizeObserver.disconnect();
|
||||||
}
|
}
|
||||||
|
// Fallback autofocus with tick to ensure inputElement is bound
|
||||||
|
if (autofocus && inputElement) {
|
||||||
|
await tick();
|
||||||
|
inputElement.focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get display text for the input
|
// Get display text for the input
|
||||||
@ -204,6 +206,7 @@
|
|||||||
class="w-full bg-transparent focus:outline-none {selected
|
class="w-full bg-transparent focus:outline-none {selected
|
||||||
? 'text-black'
|
? 'text-black'
|
||||||
: 'text-gray-700'}"
|
: 'text-gray-700'}"
|
||||||
|
{autofocus}
|
||||||
on:focus={handleInputFocus}
|
on:focus={handleInputFocus}
|
||||||
on:input={handleInput}
|
on:input={handleInput}
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user