Skip to content

fix(web-components): #4457 respect text resize in stepper layout - #4627

Open
sylvesterkaczmarek wants to merge 1 commit into
mi6:developfrom
sylvesterkaczmarek:fix/4457-stepper-text-resize
Open

fix(web-components): #4457 respect text resize in stepper layout#4627
sylvesterkaczmarek wants to merge 1 commit into
mi6:developfrom
sylvesterkaczmarek:fix/4457-stepper-text-resize

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary of the changes

Fix IcStepper automatic compact-mode behaviour when users increase browser or root text size.

Default step dimensions are rem-based, but the compact-mode breakpoint was calculated in fixed pixels. At larger text sizes the steps therefore grew while the breakpoint stayed unchanged, which could create horizontal overflow instead of switching to the compact variant.

Changes:

  • scale the automatic compact breakpoint using the current root font size so it stays aligned with the rem-based step dimensions
  • observe child step dimensions as well as the stepper so text-size changes after render trigger recalculation
  • preserve the existing custom connectorWidth behaviour
  • add unit coverage for normal and 200% root text sizes
  • add a Cypress accessibility/visual regression at 200% text size asserting compact mode and no horizontal overflow

This addresses the WCAG 1.4.4 resize-text/reflow problem described in the issue.

Related issue

Closes #4457

Comment on lines +31 to +53
it("switches to compact mode at 200% text size without horizontal overflow", () => {
cy.viewport(800, 600);
cy.injectAxe();
mount(<TextResizeStepper />);
cy.checkHydrated(STEPPER);

cy.document().then((doc) => {
doc.documentElement.style.fontSize = "32px";
});

cy.get(STEPPER).should("have.class", "ic-stepper-compact");

cy.get(CONTAINER).then(($container) => {
const container = $container[0];
expect(container.scrollWidth).to.be.at.most(container.clientWidth);
});

cy.checkA11yWithWait();
cy.compareSnapshot({
name: "/text-resize-200-percent",
testThreshold: setThresholdBasedOnEnv(DEFAULT_TEST_THRESHOLD),
});
});

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.

Please move this test into IcStepper.cy.tsx instead of in its own separate file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated as requested: moved the Cypress test into IcStepper.cy.tsx and the unit tests into ic-stepper.spec.ts. Thanks!

@GCHQ-Developer-530 GCHQ-Developer-530 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.

Looks like these changes are causing failures in the Cypress and unit tests. Would you be able to fix them?

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Looks like these changes are causing failures in the Cypress and unit tests. Would you be able to fix them?

Thanks, I dug into this further. One complication is that the branch currently contains a much larger history than the Stepper change itself (44 commits / 73 changed files), which is making the CI failures rather noisy. :)

I also found that the scope check rejects a commit touching both web-components and the corresponding React Stepper test. I think the cleanest solution here is probably to rebase/clean up the branch rather than trying to work around the individual failures.

For future cross-package changes like this, it may also be worth considering a shared/cross-package commit scope or more path-targeted CI, so a component change and its React test can travel together without conflicting with the scope checks.

@GCHQ-Developer-530

Copy link
Copy Markdown
Contributor

Please rebase this branch

@GCHQ-Developer-530
GCHQ-Developer-530 force-pushed the fix/4457-stepper-text-resize branch from 1569127 to 419babd Compare August 25, 2026 13:04
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