mirror of
https://github.com/zadam/trilium.git
synced 2026-02-07 22:34:24 +01:00
client/search: fix menu dropdowns getting clipped
This commit is contained in:
parent
2c74697fb1
commit
ff2a3d6a28
@ -17,6 +17,10 @@
|
||||
.collapsible-body {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
|
||||
&.fully-expanded {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.collapsible-inner-body {
|
||||
|
||||
@ -27,6 +27,7 @@ export function ExternallyControlledCollapsible({ title, children, className, ex
|
||||
const { height } = useElementSize(innerRef) ?? {};
|
||||
const contentId = useUniqueName();
|
||||
const [ transitionEnabled, setTransitionEnabled ] = useState(false);
|
||||
const [ fullyExpanded, setFullyExpanded ] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
@ -35,6 +36,21 @@ export function ExternallyControlledCollapsible({ title, children, className, ex
|
||||
return () => clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (expanded) {
|
||||
if (transitionEnabled) {
|
||||
const timeout = setTimeout(() => {
|
||||
setFullyExpanded(true);
|
||||
}, 250);
|
||||
return () => clearTimeout(timeout);
|
||||
} else {
|
||||
setFullyExpanded(true);
|
||||
}
|
||||
} else {
|
||||
setFullyExpanded(false);
|
||||
}
|
||||
}, [expanded, transitionEnabled])
|
||||
|
||||
return (
|
||||
<div className={clsx("collapsible", className, {
|
||||
expanded,
|
||||
@ -53,7 +69,7 @@ export function ExternallyControlledCollapsible({ title, children, className, ex
|
||||
<div
|
||||
id={contentId}
|
||||
ref={bodyRef}
|
||||
className="collapsible-body"
|
||||
className={clsx("collapsible-body", {"fully-expanded": fullyExpanded})}
|
||||
style={{ height: expanded ? height : "0" }}
|
||||
aria-hidden={!expanded}
|
||||
>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user