Skip to content

Conversation

@hcopp
Copy link
Contributor

@hcopp hcopp commented Jan 27, 2026

What changed? Why?

This change enables support for using padding props on Tab related components, including SegmentedTabs and PeriodSelector.

This request came in by a user wanting to use PeriodSelector with padding. While I do not foresee users wanting to add padding to SegmentedTabs, it is much easier to visualize the issue there as it has a background.

Root cause (required for bugfixes)

On web we were "double counting" padding by having the active indicator be offset by padding and then adding it to our x value. This meant that it would be too far over to the right.

On mobile we weren't setting the y value of the element, since it needed explicit x/y offset. This meant that it would sit at the top, not impacted by padding.

We fixed these by setting left={0} on web and on mobile setting the y value of the active indicator.

UI changes

iOS Old iOS New
iOS Old iOS New
Web Old Web New
image image
Web Old Web New
image image

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 27, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

const animatedBoxStyle = useAnimatedStyle(
() => ({
transform: [{ translateX: animatedTabRect.value.x }],
transform: [{ translateX: animatedTabRect.value.x }, { translateY: animatedTabRect.value.y }],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On mobile we only needed to track the y value

data-testid="tabs-active-indicator"
height={height}
initial={false}
left={0}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On web we only needed to set the left offset to 0, so that the logic for tracking position doesn't add the left offset on top of the default padding. This isn't a worry for y since we aren't animating by y it will simply use the default padding.

We could in theory adjust the activeTabRect above to track y and update active animation as well and then we would need to add top={0}. But this is a simpler solution.

@hcopp hcopp marked this pull request as ready for review January 27, 2026 14:48
@hcopp hcopp self-assigned this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants