Skip to content

Conversation

@mxschll
Copy link
Member

@mxschll mxschll commented Nov 24, 2025

Description

Extends the segmented control component with a style API for customization, allowing developers to override default component styles.

Related links, issue #, if available: n/a

How has this been tested?

  • Added unit tests for style prop validation and CSS class application
  • Screenshot tests passed without visual regressions
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (0c4c33e) to head (201cf0f).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4068   +/-   ##
=======================================
  Coverage   97.12%   97.12%           
=======================================
  Files         863      864    +1     
  Lines       25294    25318   +24     
  Branches     9119     9136   +17     
=======================================
+ Hits        24566    24590   +24     
  Misses        722      722           
  Partials        6        6           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mxschll mxschll force-pushed the dev-v3-schomax-segmented-control branch from 92d5cf0 to a1949e4 Compare November 24, 2025 19:49
@mxschll mxschll marked this pull request as ready for review November 25, 2025 09:15
@mxschll mxschll requested a review from a team as a code owner November 25, 2025 09:15
@mxschll mxschll requested review from gethinwebster and jperals and removed request for a team and gethinwebster November 25, 2025 09:15
},
};

const iconSvg = (
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: is the custom SVG relevant to this feature?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's out of scope for now.

Copy link
Member

Choose a reason for hiding this comment

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

What I mean is whether it makes sense to include this in the dev page for testing. Can using iconSvg affect the custom styles (or the other way around) in any way?

I wonder if the dev page can be even further simplified if we only include the prop values that are relevant to test the custom styles feature.

Not a blocker though.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, thanks for pointing that out.


exports[`getSegmentedControlSegmentStyles handles all possible style configurations 1`] = `
{
"--awsui-style-background-active-d43v8n": undefined,
Copy link
Member

Choose a reason for hiding this comment

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

What do these hashes depend on? Can they change due to something unrelated?

Copy link
Member Author

Choose a reason for hiding this comment

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

The hash is dependent on the list in custom-css-properties.js and get generated using this function:

const hash = getHashDigest(Buffer.from(JSON.stringify(customCssPropertiesList)), 'md5', 'base36', 6);

They will change if we introduce a new custom property, which is rarely the case. I agree that this is not ideal, but I think we can live with that for now until we have a more general solution for testing the style api. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I have doubts whether we need these snapshot tests, provided that we have visual regression tests in the pipeline.

Even if adding new custom properties is rare, when we do it these tests will fail unexpectedly, but the end user experience will not change —in this sense, the visual result is what matters here.

This said, not a blocker.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think we might need to think about a more unified testing strategy for the style api overall. Maybe introducing a small util function would help.

Copy link
Member

@jperals jperals left a comment

Choose a reason for hiding this comment

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

No blocking comments

@mxschll mxschll added this pull request to the merge queue Nov 25, 2025
Merged via the queue into main with commit fe52d2c Nov 25, 2025
50 checks passed
@mxschll mxschll deleted the dev-v3-schomax-segmented-control branch November 25, 2025 16:23
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.

2 participants