Fix: search input controls styling and restore mind map modal overlay (#17436)

This commit is contained in:
euvre
2026-07-29 09:36:07 +08:00
committed by GitHub
parent 8d1eff6ea2
commit e5bb2b60c0
3 changed files with 32 additions and 27 deletions

View File

@@ -15,6 +15,12 @@ export function useAutoResizeTextarea(
const el = ref.current;
if (!el) return;
el.style.height = 'auto';
// scrollHeight excludes borders while height is border-box, so the
// content box ends up a couple of pixels short and overflow-y-auto
// would show a scrollbar even for a single line. Hide it until the
// content actually exceeds the max height.
const overflowing = el.scrollHeight > maxHeight;
el.style.overflowY = overflowing ? 'auto' : 'hidden';
el.style.height = `${Math.min(el.scrollHeight, maxHeight)}px`;
}, [ref, value, maxHeight]);
}