Skip to content

Commit 9214b09

Browse files
fix(stepper): prevent content shift in vertical stepper - master (#16831)
1 parent 441b8f8 commit 9214b09

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

projects/igniteui-angular/core/src/core/styles/components/stepper/_stepper-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350

351351
%igx-stepper__step-content-wrapper {
352352
margin-inline-start: $v-line-indent;
353+
padding-inline-start: $v-line-indent;
353354
position: relative;
354355
min-height: if($variant == 'indigo', rem(24px), rem(32px));
355356

@@ -364,12 +365,6 @@
364365
}
365366
}
366367

367-
[aria-selected='true'] {
368-
%igx-stepper__step-content-wrapper {
369-
padding-inline-start: $v-line-indent;
370-
}
371-
}
372-
373368
@if $variant == 'indigo' {
374369
[aria-selected='true'] {
375370
%igx-stepper__step-content-wrapper {

projects/igniteui-angular/stepper/src/stepper/stepper.component.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,32 @@ describe('Rendering Tests', () => {
740740
expect(Math.abs(width - height)).toBeLessThan(1.5);
741741
expect(Math.abs(width - parseFloat(minWidth))).toBeLessThan(1.5);
742742
}));
743+
744+
it('should not shift step content horizontally when navigating between steps in vertical mode', fakeAsync(() => {
745+
const indicatorFix = TestBed.createComponent(IgxStepperIndicatorNoShrinkComponent);
746+
indicatorFix.detectChanges();
747+
const indicatorStepper = indicatorFix.componentInstance.stepper;
748+
749+
const getContentWrapperStyles = (stepIndex: number) => {
750+
const contentWrapper = indicatorStepper.steps[stepIndex].nativeElement.querySelector('.igx-stepper__step-content-wrapper') as HTMLElement;
751+
const styles = window.getComputedStyle(contentWrapper);
752+
return {
753+
paddingInlineStart: styles.paddingInlineStart || styles.paddingLeft,
754+
marginInlineStart: styles.marginInlineStart || styles.marginLeft
755+
};
756+
};
757+
758+
const step0ActiveStyles = getContentWrapperStyles(0);
759+
760+
indicatorStepper.navigateTo(1);
761+
indicatorFix.detectChanges();
762+
tick(500);
763+
764+
const step0InactiveStyles = getContentWrapperStyles(0);
765+
766+
expect(step0InactiveStyles.paddingInlineStart).toBe(step0ActiveStyles.paddingInlineStart);
767+
expect(step0InactiveStyles.marginInlineStart).toBe(step0ActiveStyles.marginInlineStart);
768+
}));
743769
});
744770

745771
describe('Keyboard navigation', () => {

0 commit comments

Comments
 (0)