Skip to content

Commit 7ce9621

Browse files
fix(stepper): prevent content shift in vertical stepper - 20.1.x (#16833)
1 parent 042072f commit 7ce9621

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

projects/igniteui-angular/src/lib/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/src/lib/stepper/stepper.component.spec.ts

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

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

0 commit comments

Comments
 (0)