Skip to content

[CDK] Can't use cdkStepper directly since _stepHeader isn't defined #10611

Description

@kherock

Bug, feature request, or proposal:

Bug

What is the expected behavior?

I should be able to use the [cdkStepper] selector to create a plain stepper component

What is the current behavior?

The FocusKeyManager instance expects to receive a query list it can observe changes on.

Abbreviated stack trace:

ERROR TypeError: Cannot read property 'changes' of undefined
at FocusKeyManager.ListKeyManager (list-key-manager.ts:60)
at new FocusKeyManager (focus-key-manager.ts:22)
at CdkStepper.ngAfterViewInit (stepper.ts:203)

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-68xhyx

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

^5.2.4 and ^6.0.0-beta.4

Is there anything else we should know?

I'm guessing if I want to make my own stepper component I should try to copy MatStepper's implementation and extend CdkStepper. However, I'd much rather compose my own stepper using the CDK components since I haven't had great experience extending components in Angular due to the way decorators work.

The CDK stepper lacks any guide for actual usage beyond its API, so it's inconvenient I have to figure out what variables like _stepHeader are for by reading the source code of a fairly complicated component like the material stepper.

Anyway, to fix this I think providing a very basic [cdkStepHeader] directive with the _stepHeader declaration changed to

@ContentChildren(CdkStepHeader) _stepHeader: QueryList<FocusableOption>;

would go a long way.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions