Skip to content
TypeScript

fix(web): composer context strip no longer counts its padding as free space (#13642)

Michał Pierzchała4131e6d77685
diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx
index 53d320192f3..f546658a377 100644
--- a/apps/web/src/components/BranchToolbar.tsx
+++ b/apps/web/src/components/BranchToolbar.tsx
@@ -426,8 +426,13 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
const current = element;
const compact = overflows;
if (!current) return;
- const available = current.clientWidth;
- if (available === 0) return;
+ const stripWidth = current.clientWidth;
+ if (stripWidth === 0) return;
+ const stripStyle = getComputedStyle(current);
+ const available =
+ stripWidth -
+ (Number.parseFloat(stripStyle.paddingInlineStart) || 0) -
+ (Number.parseFloat(stripStyle.paddingInlineEnd) || 0);
const contentWidth = (parent: Element): number => {
const gap = Number.parseFloat(getComputedStyle(parent).columnGap) || 0;
let width = 0;
@@ -446,7 +451,7 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
}
return width + gap * Math.max(0, counted - 1);
};
- const stripGap = Number.parseFloat(getComputedStyle(current).columnGap) || 0;
+ const stripGap = Number.parseFloat(stripStyle.columnGap) || 0;
let needed = 0;
let groups = 0;
for (const child of current.children) {