diff --git a/ka-note/client/src/lib/components/DarkSelect.svelte b/ka-note/client/src/lib/components/DarkSelect.svelte
index 1107356..d236be6 100644
--- a/ka-note/client/src/lib/components/DarkSelect.svelte
+++ b/ka-note/client/src/lib/components/DarkSelect.svelte
@@ -17,6 +17,15 @@
let open = $state(false);
let container: HTMLDivElement;
+ let button: HTMLButtonElement;
+ let openUp = $state(false);
+
+ function calcDirection() {
+ if (!button) return;
+ const rect = button.getBoundingClientRect();
+ const spaceBelow = window.innerHeight - rect.bottom;
+ openUp = spaceBelow < 260; // less than max-h-60 (240px) + margin
+ }
const selected = $derived(options.find(o => o.value === value) ?? options[0]);
@@ -35,16 +44,17 @@
{#if open}
-
+
{#each options as opt}