Skip to content

Resolve more changed after checked errors #31208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions goldens/cdk/stepper/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@ export class CdkStep implements OnChanges {
get completed(): boolean;
set completed(value: boolean);
// (undocumented)
_completedOverride: boolean | null;
_completedOverride: i0.WritableSignal<boolean | null>;
content: TemplateRef<any>;
// (undocumented)
_displayDefaultIndicatorType: boolean;
editable: boolean;
get editable(): boolean;
set editable(value: boolean);
errorMessage: string;
get hasError(): boolean;
set hasError(value: boolean);
interacted: boolean;
readonly index: i0.WritableSignal<number>;
readonly indicatorType: i0.Signal<string>;
get interacted(): boolean;
set interacted(value: boolean);
readonly interactedStream: EventEmitter<CdkStep>;
readonly isNavigable: i0.Signal<boolean>;
readonly isSelected: i0.Signal<boolean>;
label: string;
// (undocumented)
_markAsInteracted(): void;
Expand All @@ -55,7 +61,8 @@ export class CdkStep implements OnChanges {
reset(): void;
select(): void;
_showError(): boolean;
state: StepState;
get state(): StepState;
set state(value: StepState);
stepControl: AbstractControl;
stepLabel: CdkStepLabel;
// (undocumented)
Expand Down Expand Up @@ -97,7 +104,6 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
protected _elementRef: ElementRef<HTMLElement>;
_getAnimationDirection(index: number): StepContentPositionState;
_getFocusIndex(): number | null;
_getIndicatorType(index: number, state?: StepState): StepState;
_getStepContentId(i: number): string;
_getStepLabelId(i: number): string;
linear: boolean;
Expand Down
3 changes: 0 additions & 3 deletions goldens/material/stepper/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class MatStepHeader extends CdkStepHeader implements AfterViewInit, OnDes
// (undocumented)
_getDefaultTextForState(state: StepState): string;
_getHostElement(): HTMLElement;
_getIconContext(): MatStepperIconContext;
iconOverrides: {
[key: string]: TemplateRef<MatStepperIconContext>;
};
Expand Down Expand Up @@ -138,8 +137,6 @@ export class MatStepper extends CdkStepper implements AfterViewInit, AfterConten
// (undocumented)
ngOnDestroy(): void;
_stepHeader: QueryList<MatStepHeader>;
// (undocumented)
_stepIsNavigable(index: number, step: MatStep): boolean;
readonly steps: QueryList<MatStep>;
_steps: QueryList<MatStep>;
// (undocumented)
Expand Down
24 changes: 12 additions & 12 deletions src/cdk/a11y/key-manager/list-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type ListKeyManagerModifierKey = 'altKey' | 'ctrlKey' | 'metaKey' | 'shif
* of items, it will set the active item correctly when arrow events occur.
*/
export class ListKeyManager<T extends ListKeyManagerOption> {
private _activeItemIndex = -1;
private _activeItemIndex = signal(-1);
private _activeItem = signal<T | null>(null);
private _wrap = false;
private _typeaheadSubscription = Subscription.EMPTY;
Expand Down Expand Up @@ -209,7 +209,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
this.updateActiveItem(item);

if (this._activeItem() !== previousActiveItem) {
this.change.next(this._activeItemIndex);
this.change.next(this._activeItemIndex());
}
}

Expand Down Expand Up @@ -279,7 +279,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {

case PAGE_UP:
if (this._pageUpAndDown.enabled && isModifierAllowed) {
const targetIndex = this._activeItemIndex - this._pageUpAndDown.delta;
const targetIndex = this._activeItemIndex() - this._pageUpAndDown.delta;
this._setActiveItemByIndex(targetIndex > 0 ? targetIndex : 0, 1);
break;
} else {
Expand All @@ -288,7 +288,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {

case PAGE_DOWN:
if (this._pageUpAndDown.enabled && isModifierAllowed) {
const targetIndex = this._activeItemIndex + this._pageUpAndDown.delta;
const targetIndex = this._activeItemIndex() + this._pageUpAndDown.delta;
const itemsLength = this._getItemsArray().length;
this._setActiveItemByIndex(targetIndex < itemsLength ? targetIndex : itemsLength - 1, -1);
break;
Expand All @@ -312,7 +312,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {

/** Index of the currently active item. */
get activeItemIndex(): number | null {
return this._activeItemIndex;
return this._activeItemIndex();
}

/** The active item. */
Expand All @@ -337,12 +337,12 @@ export class ListKeyManager<T extends ListKeyManagerOption> {

/** Sets the active item to the next enabled item in the list. */
setNextItemActive(): void {
this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);
this._activeItemIndex() < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);
}

/** Sets the active item to a previous enabled item in the list. */
setPreviousItemActive(): void {
this._activeItemIndex < 0 && this._wrap
this._activeItemIndex() < 0 && this._wrap
? this.setLastItemActive()
: this._setActiveItemByDelta(-1);
}
Expand All @@ -366,7 +366,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {

// Explicitly check for `null` and `undefined` because other falsy values are valid.
this._activeItem.set(activeItem == null ? null : activeItem);
this._activeItemIndex = index;
this._activeItemIndex.set(index);
this._typeahead?.setCurrentSelectedItemIndex(index);
}

Expand Down Expand Up @@ -398,7 +398,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
const items = this._getItemsArray();

for (let i = 1; i <= items.length; i++) {
const index = (this._activeItemIndex + delta * i + items.length) % items.length;
const index = (this._activeItemIndex() + delta * i + items.length) % items.length;
const item = items[index];

if (!this._skipPredicateFn(item)) {
Expand All @@ -414,7 +414,7 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
* it encounters either end of the list, it will stop and not wrap.
*/
private _setActiveInDefaultMode(delta: -1 | 1): void {
this._setActiveItemByIndex(this._activeItemIndex + delta, delta);
this._setActiveItemByIndex(this._activeItemIndex() + delta, delta);
}

/**
Expand Down Expand Up @@ -456,8 +456,8 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
if (activeItem) {
const newIndex = newItems.indexOf(activeItem);

if (newIndex > -1 && newIndex !== this._activeItemIndex) {
this._activeItemIndex = newIndex;
if (newIndex > -1 && newIndex !== this._activeItemIndex()) {
this._activeItemIndex.set(newIndex);
this._typeahead?.setCurrentSelectedItemIndex(newIndex);
}
}
Expand Down
Loading
Loading