[Glitch] Fix custom profile field overflow
Port 2a894970ac8d052b196969668c5dd8c81c48cca0 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
2f491f0d48
commit
81590f1c9c
@ -337,10 +337,12 @@ function useFieldOverflow() {
|
||||
if (!wrapperEle) return;
|
||||
|
||||
const wrapperStyles = getComputedStyle(wrapperEle);
|
||||
const maxWidth =
|
||||
wrapperEle.offsetWidth -
|
||||
(parseFloat(wrapperStyles.paddingLeft) +
|
||||
parseFloat(wrapperStyles.paddingRight));
|
||||
const nonContentWidth =
|
||||
parseFloat(wrapperStyles.paddingLeft) +
|
||||
parseFloat(wrapperStyles.paddingRight) +
|
||||
parseFloat(wrapperStyles.borderLeftWidth) +
|
||||
parseFloat(wrapperStyles.borderRightWidth);
|
||||
const availableContentWidth = wrapperEle.offsetWidth - nonContentWidth;
|
||||
|
||||
const label = wrapperEle.querySelector<HTMLSpanElement>(
|
||||
'dt > [data-contents]',
|
||||
@ -349,8 +351,12 @@ function useFieldOverflow() {
|
||||
'dd > [data-contents]',
|
||||
);
|
||||
|
||||
setIsLabelOverflowing(label ? label.scrollWidth > maxWidth : false);
|
||||
setIsValueOverflowing(value ? value.scrollWidth > maxWidth : false);
|
||||
setIsLabelOverflowing(
|
||||
label ? label.scrollWidth > availableContentWidth : false,
|
||||
);
|
||||
setIsValueOverflowing(
|
||||
value ? value.scrollWidth > availableContentWidth : false,
|
||||
);
|
||||
}, []);
|
||||
|
||||
const observer = useResizeObserver(handleRecalculate);
|
||||
|
||||
@ -356,7 +356,7 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
|
||||
|
||||
&.fieldItem {
|
||||
border-color: var(--color-border-success-soft);
|
||||
padding-right: 32px; // 8px padding + 16px for the icon + 8px gap
|
||||
padding-right: 30px; // 8px padding + 16px for the icon + 8px gap - 2px tolerance
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user