Skip to content

fix(stepper-item): keep initial focus on newly selected item #11482

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
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ export class StepperItem extends LitElement implements InteractiveComponent, Loa

override updated(): void {
updateHostInteraction(this);
setAttribute(
this.el,
"tabindex",
this.disabled || this.layout.includes("horizontal") ? null : 0,
);
}

loaded(): void {
Expand Down Expand Up @@ -327,7 +332,6 @@ export class StepperItem extends LitElement implements InteractiveComponent, Loa
/* TODO: [MIGRATION] This used <Host> before. In Stencil, <Host> props overwrite user-provided props. If you don't wish to overwrite user-values, replace "=" here with "??=" */
this.el.ariaCurrent = this.selected ? "step" : "false";
/* TODO: [MIGRATION] This used <Host> before. In Stencil, <Host> props overwrite user-provided props. If you don't wish to overwrite user-values, add a check for this.el.hasAttribute() before calling setAttribute() here */
setAttribute(this.el, "tabIndex", this.disabled ? -1 : 0);

// use local var to bypass logic-changing compiler transformation
const innerDisplayContextTabIndex = this.layout === "horizontal" && !this.disabled ? 0 : null;
Expand Down
Loading