Skip to content

Commit 4131e6d

Browse files
fix(web): composer context strip no longer counts its padding as free space (pingdotgg#13642)
Co-authored-by: Julius Marminge <[email protected]>
1 parent 0d9668c commit 4131e6d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,13 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
426426
const current = element;
427427
const compact = overflows;
428428
if (!current) return;
429-
const available = current.clientWidth;
430-
if (available === 0) return;
429+
const stripWidth = current.clientWidth;
430+
if (stripWidth === 0) return;
431+
const stripStyle = getComputedStyle(current);
432+
const available =
433+
stripWidth -
434+
(Number.parseFloat(stripStyle.paddingInlineStart) || 0) -
435+
(Number.parseFloat(stripStyle.paddingInlineEnd) || 0);
431436
const contentWidth = (parent: Element): number => {
432437
const gap = Number.parseFloat(getComputedStyle(parent).columnGap) || 0;
433438
let width = 0;
@@ -446,7 +451,7 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
446451
}
447452
return width + gap * Math.max(0, counted - 1);
448453
};
449-
const stripGap = Number.parseFloat(getComputedStyle(current).columnGap) || 0;
454+
const stripGap = Number.parseFloat(stripStyle.columnGap) || 0;
450455
let needed = 0;
451456
let groups = 0;
452457
for (const child of current.children) {

0 commit comments

Comments
 (0)