Skip to content

Commit

Permalink
fix(Tabs): adjust active position calculation to account for border w…
Browse files Browse the repository at this point in the history
…idth

Signed-off-by: donniean <[email protected]>
  • Loading branch information
donniean committed Jan 6, 2025
1 parent 0d3d150 commit e7c85b1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/components/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,17 @@ export function Tabs({
if (_activeKey in refs.current && wrapperRef.current) {
const element = refs.current[_activeKey];
const rect = element.getBoundingClientRect();

const wrapperStyle = window.getComputedStyle(wrapperRef.current);
const borderLeftWidth = parseFloat(wrapperStyle.borderLeftWidth);

setActivePosition({
width: rect.width,
height: rect.height,
translate: rect.x - wrapperRef.current.getBoundingClientRect().x - WRAPPER_PADDING,
translate:
rect.x -
(wrapperRef.current.getBoundingClientRect().x + borderLeftWidth + 1) -
WRAPPER_PADDING,
translateY: rect.y - wrapperRef.current.getBoundingClientRect().y - WRAPPER_PADDING,
});

Expand Down

0 comments on commit e7c85b1

Please sign in to comment.