Skip to content

chore: replace left/right prop values with start/end - #85

Open
LinKCoding wants to merge 14 commits into
mainfrom
kl-gmt-1803-props-unification
Open

LinKCoding wants to merge 14 commits into
mainfrom
kl-gmt-1803-props-unification

Conversation

@LinKCoding

@LinKCoding LinKCoding commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Directional prop values now use logical start / end instead of physical left / right, so they stay correct in right-to-left (RTL) layouts.
There are no left / right aliases.
Consuming apps will be migrated with a codemod in a separate branch.

Component props (feat!)

  • Disclosure buttonPlacement
  • Drawer alignContentContainer
  • Flyout openFrom
  • SelectDropdown menuAlignment
  • DataList column, ListCol, and FilterControl justify
  • Toggle labelSide
  • iconPosition on FillButton, StrokeButton, TextButton, Anchor, Tag, and Badge
  • GridForm section layout and submit.position

Popover, PopoverContainer, and Tips alignments (feat!)

  • Popover align and beak (also Coachmark beak): start | end | center
  • PopoverContainer alignment: top-start, top-end, bottom-start, bottom-end, top, bottom, start, end
  • ToolTip, InfoTip, and PreviewTip alignment (and Modal tipAlignment): top-start, top-end, bottom-start, bottom-end, start-center, end-center, top-center, bottom-center

PopoverContainer resolves logical alignments to physical ones with resolvePhysicalAlignment, which replaces mirrorAlignment.
Popover's resolveHorizontalSideForRtl now takes start / end and returns a physical side.

CSS keyword swaps (fix)

SelectDropdown option labels, DataList SortControl, the ProgressBar percent label, and a few stories and Storybook components now use start / end for text-align and justify-content.
LTR rendering is unchanged.

Docs

The naming conventions rationale page explains why prop values use start / end, and the writing guidance page links to it and covers prop values in its RTL rule.
Stories, gamut-docs pages, and agent skills are updated to match.

Code Connect files keep left / right with TODO comments until the Figma changes take effect.

Not in this PR

  • BarChart ScaleChartHeader textAlign, which needs its left: % / translateX math made direction-aware first.
  • List backgroundPosition: 'right', which has no logical CSS keyword.
  • Card shadow values patternLeft / patternRight.

BREAKING CHANGE: left and right are no longer accepted in these prop values.
Use start in place of left and end in place of right, e.g. top-left becomes top-start and right-center becomes end-center.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1803
  • Changeset added (or empty changeset if no release)
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • Package previews from this PR are passing end-to-end tests in all relevant consuming repositories

Testing Instructions

Check each of the following Storybook pages three ways:

  1. Set the LogicalProps toolbar to Physical and Direction to Left-to-Right (LTR), and confirm the page looks the same as main.
  2. Set LogicalProps to Logical and confirm the page still looks the same in LTR.
  3. Set Direction to Right-to-Left (RTL) and confirm start / end placements mirror: start sits on the right and end sits on the left.

Component props

  • Containers/Disclosure: the body button sits at the end by default and at the start when the buttonPlacement control is set to start.
  • Containers/Drawer: the content stays pinned to the alignContentContainer edge while the drawer animates.
  • Overlays/Flyout: the flyout opens from the start edge by default.
  • Inputs & forms/SelectDropdown: the menu lines up with the input's end edge in the menuAlignment: 'end' story, and option right labels align to the end.
  • Data display/DataTable and Data display/DataList: justify: 'end' columns align to the end, column filter menus open toward the inside of the table, and sort headers align to the start.
  • Data display/List/List, Data display/List/ListCol, and Data display/List/ListRow: justify="end" columns align to the end.
  • Actions/Toggle: the label sits at the end by default and at the start with labelSide: 'start'.
  • Actions/Buttons/Button Examples, Actions/Buttons/FillButton, Actions/Buttons/StrokeButton, and Actions/Buttons/TextButton: icons sit before the label by default and after it with iconPosition="end".
  • Navigation/Anchor: same iconPosition check as the buttons.
  • Actions/Tag and Status/Badge: icons sit before the label.
  • Inputs & forms/GridForm/Buttons, Inputs & forms/GridForm/Layout, and Inputs & forms/GridForm/Usage: the submit button follows submit.position, and section titles with layout: 'start' take the start column.

Popover, PopoverContainer, and Tips alignments

  • Overlays/Popover: check every align / beak story, including Center Left, Center Right, the pattern stories, and the Rtl stories, and confirm the beak points at the target.
  • Overlays/PopoverContainer: check each corner and single-side alignment, inline and portaled.
  • Feedback/Coachmark: the beak sits on the beak side.
  • Feedback/Tips/ToolTip, Feedback/Tips/InfoTip, and Feedback/Tips/PreviewTip: check every alignment, both inline and floating, and confirm the beak points at the trigger.
  • Actions/Menu/Menu and Actions/Menu/MenuItem: end-center tooltips open beside the item.
  • Actions/Buttons/IconButton: tooltips open on the selected side.
  • Inputs & forms/DatePicker, Inputs & forms/Form/FormGroup, Feedback/Alert, and Patterns/FloatingMenu: popovers and tips open where they did before.

CSS keyword swaps

  • Status/ProgressBar: the percent label aligns to the end.
  • Data display/BarChart: the external title story aligns to the end.

Docs

  • In gamut-docs, read Concepts/Naming conventions rationale and Guides/Writing guidance, and click the reading-direction rationale link to confirm it lands on the "Staying correct in both reading directions" section.

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@skillsoft/eslint-plugin-gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@85.tgz

@skillsoft/gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@85.tgz

@skillsoft/gamut-agent-tools

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@85.tgz

@skillsoft/gamut-codemods

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@85.tgz

@skillsoft/gamut-icons

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@85.tgz

@skillsoft/gamut-illustrations

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@85.tgz

@skillsoft/gamut-patterns

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@85.tgz

@skillsoft/gamut-styles

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@85.tgz

@skillsoft/gamut-tests

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@85.tgz

@skillsoft/variance

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@85
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@85.tgz

commit: 4bdebde

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.20%. Comparing base (7f6b1f1) to head (4bdebde).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/gamut/src/Flyout/index.tsx 0.00% 4 Missing ⚠️
packages/gamut/src/Toggle/index.tsx 0.00% 4 Missing ⚠️
...amut/src/Form/inputs/SelectDropdown/core/styles.ts 0.00% 3 Missing ⚠️
packages/gamut/src/Tips/PreviewTip/styles.ts 0.00% 3 Missing ⚠️
...ages/gamut/src/DataList/Controls/FilterControl.tsx 0.00% 2 Missing ⚠️
packages/gamut/src/Drawer/index.tsx 0.00% 2 Missing ⚠️
...ges/gamut/src/Tips/shared/popoverAlignmentUtils.ts 81.81% 2 Missing ⚠️
packages/gamut/src/Badge/index.tsx 0.00% 1 Missing ⚠️
...ckages/gamut/src/DataList/Tables/Rows/TableRow.tsx 0.00% 1 Missing ⚠️
packages/gamut/src/DatePicker/DatePicker.tsx 0.00% 1 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff            @@
##           main      #85       +/-   ##
=========================================
+ Coverage      0   77.20%   +77.20%     
=========================================
  Files         0      464      +464     
  Lines         0    32093    +32093     
  Branches      0     1500     +1500     
=========================================
+ Hits          0    24778    +24778     
- Misses        0     7315     +7315     
Flag Coverage Δ
pull-request 77.20% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

LinKCoding and others added 7 commits November 16, 2026 16:21
Directional props now use logical `start` / `end` values instead of physical `left` / `right`.

- Disclosure `buttonPlacement`
- Drawer `alignContentContainer`
- Flyout `openFrom`
- SelectDropdown `menuAlignment`
- DataList column, ListCol, and FilterControl `justify`
- Toggle `labelSide`
- `iconPosition` on FillButton, StrokeButton, TextButton, Anchor, Tag, and Badge
- GridForm section `layout` and `submit.position`

Stories, docs, and agent skills are updated to match.
Code Connect files keep `left` / `right` with TODO comments until the Figma changes take effect.

BREAKING CHANGE: `left` and `right` are no longer accepted for these props.
Use `start` in place of `left` and `end` in place of `right`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… PopoverContainer, and Tips

Popover, PopoverContainer, and Tips alignment values now use logical `start` / `end` instead of physical `left` / `right`.

- Popover `align` and `beak` (also Coachmark `beak`): `start` | `end` | `center`
- PopoverContainer `alignment`: `top-start`, `top-end`, `bottom-start`, `bottom-end`, `top`, `bottom`, `start`, `end`
- ToolTip, InfoTip, and PreviewTip `alignment` (and Modal `tipAlignment`): `top-start`, `top-end`, `bottom-start`, `bottom-end`, `start-center`, `end-center`, `top-center`, `bottom-center`

PopoverContainer resolves logical alignments to physical ones with `resolvePhysicalAlignment`, which replaces `mirrorAlignment`.
Popover's `resolveHorizontalSideForRtl` now takes `start` / `end` and returns a physical side.
Internal beak variant keys use `start` / `end`; pattern variants and beak rotations stay physical.

Stories, tests, docs, and agent skills are updated to match.
Code Connect files keep their current values with TODO comments until the Figma changes take effect.
This also fixes two GridForm docs lines missed in the previous commit.

BREAKING CHANGE: `left` and `right` are no longer accepted in these alignment values.
Use `start` in place of `left` and `end` in place of `right`, e.g. `top-left` becomes `top-start` and `right-center` becomes `end-center`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Physical `left` / `right` CSS keyword values now use logical `start` / `end`, so they flip in RTL.

- SelectDropdown option label `textAlign`
- DataList SortControl `textAlign`
- ProgressBar percent label `text-align`
- BarChart and Menu story alignment
- Storybook TableOfContents and ImageGallery `textAlign`

LTR rendering is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The naming conventions rationale page now explains why prop values use `start` / `end` instead of `left` / `right`, and why `start` / `end` is preferred over `leading` / `trailing` for values.
The writing guidance page links to the rationale page and updates the RTL rule to cover prop values.
The rule no longer says `start` / `end` replace `top` / `bottom`, which contradicted the renamed values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The "Staying correct in both reading directions" section now explains the `start` / `end` values Gamut uses and why, then the `left` / `right` values they replaced and why those no longer suit RTL layouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LinKCoding
LinKCoding force-pushed the kl-gmt-1803-props-unification branch from 7f9cd93 to 9775597 Compare November 16, 2026 21:21
@LinKCoding
LinKCoding marked this pull request as ready for review November 16, 2026 21:21
@LinKCoding
LinKCoding requested a review from a team as a code owner November 16, 2026 21:21

This comment was marked as outdated.

@LinKCoding
LinKCoding added this pull request to stack #95 November 20, 2026 21:20
LinKCoding and others added 5 commits November 20, 2026 16:29
Resolve conflicts: keep the styleguide package deleted as on main, and use the branch's story versions for List, Popover, and PreviewTip, with left/right values updated to start/end.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@aresnik11 aresnik11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Spot checked most of them and have a few follow up comments and some existing bugs but overall this is great!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should rename this to be MenuAlignmentEnd

@@ -32,7 +32,7 @@ export const SubmitButtonRight: Story = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here can we rename these SubmitButtonStart and SubmitButtonEnd

@@ -135,11 +135,11 @@ export const Below: Story = {
};

export const CenterLeft: Story = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bunch here that we can rename the story from Left/Right to Start/End

args: { align: 'start', beak: 'center', position: 'center' },
};

export const CenterRight: Story = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can be ticketed for later but CenterRight and CenterLeft stories the spacing/alignment of the beak is a little off in RTL (existing issue)

label={{
info: 'More info here...',
alignment: 'right-center',
alignment: 'end-center',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can be ticketed for later but for end-center tooltips the spacing/alignment of the beak is a little off in RTL (existing issue)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this applies to IconButton too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems like it's rooted in popover then, curiously I haven't been able to repro

font-weight: bold;
padding: 0.5rem;
text-align: right;
text-align: end;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

confirmed the percentage sticks to end but the text doesn't flip... shouldn't 33% become %33 in rtl?

@LinKCoding LinKCoding Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch! This is what the robot says.
tl;dr: it works as intended rn, but we should prob do a locale-correct text update to our Text component


No, ProgressBar shouldn't swap the text. I read the code but didn't render it in RTL, so this is from the code and how bidi text works.

Why 33% is correct in RTL. The text is a plain string, {percent}% (ProgressBar/index.tsx:176). The Unicode bidi algorithm treats % as a number terminator, so it stays attached to the digits and the run renders as 33%, left-to-right, even inside an RTL layout. Browsers do the same. %33 is not a general RTL convention. Where the sign goes depends on the language:

  • Hebrew: 33%, same as English.
  • Turkish: %33, and Turkish is LTR.
  • Arabic and Persian: these use their own digits and sign, such as ٣٣٪, which Arabic-script locales produce but the bidi algorithm doesn't.

So the placement follows the locale and not the text direction. Flipping the string whenever the page is RTL would be wrong for Hebrew.

What your end change already handles. text-align: end (DisplayedPercent) puts the label at the trailing edge, which is the left side in RTL. That matches what the reviewer confirmed. The label sitting in the right place with its text unchanged is the correct result.

If you want locale-correct text. That would be a separate feature. You'd format with new Intl.NumberFormat(locale, { style: 'percent' }), which produces the right digits and sign per locale. The component hardcodes % and the English Progress: ${percent}% screen-reader label, so it isn't localized today. I'd leave that out of this PR, because it's a behavior change and not a rename.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants