Skip to content

Commit

Permalink
fix(#1593): prevent onClick emission if step disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
akashyeole committed Nov 19, 2024
1 parent 693cd95 commit 2c2419b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion packages/components/src/components/stepper/step/step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,24 @@ export class Step {
this.stepperState.setActiveStep(this.stepId, true)
}
}

handleStepKeyDown(event: KeyboardEvent) {
if (!this.disabled && this.stepperState.variant === 'default' && (this.clickable || this.complete) && event.key === 'Enter') {
this.stepperState.setActiveStep(this.stepId, true)
}
}

stopOnClickPropogation(event: Event) {
if (this.disabled) {
event.stopPropagation();
}
}

render() {
return (
<div aria-current = {this.active ? 'step': false}
aria-disabled = {this.active || this.complete ? false : true}
onClick={ (e) => this.stopOnClickPropogation(e) }
class = {`step-wrapper ${this.stepId === 1 ? 'first-step': ''}
${this.error ? 'error': ''}
${this.stepperState.variant}
Expand Down
5 changes: 2 additions & 3 deletions packages/components/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

</head>

<body>

<body>
</body>


</html>

0 comments on commit 2c2419b

Please sign in to comment.