Skip to content

Commit

Permalink
Merge pull request #13 from Rajdeepc/bugfix/accessibility-counter
Browse files Browse the repository at this point in the history
Added accessibility and typo issue fix on React counter package
  • Loading branch information
sadanandpai authored Jul 14, 2023
2 parents ddf7ec5 + ac3b0ab commit 14d7ca6
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions react/src/machine-coding/counter/counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,29 @@ function Counter() {
<main className={styles.main}>
<h2>{value}</h2>

<div>
<button onClick={decrement}>-</button>
<button onClick={increment}>+</button>
</div>

<div>
<label htmlFor="step">Icrement/Decrement by</label>
<section>
<button onClick={decrement} aria-label="Decrement">
-
</button>
<button onClick={increment} aria-label="Increment">
+
</button>
</section>

<section>
<label htmlFor="step">Increment/Decrement by</label>
<input
type="number"
id="step"
defaultValue={step.current}
onChange={(e) =>
setStep((e.target as HTMLInputElement).valueAsNumber)
}
onChange={(e) => setStep((e.target as HTMLInputElement).valueAsNumber)}
title="Step value"
/>
</div>
</section>

<div>
<section>
<button onClick={reset}>Reset</button>
</div>
</section>
</main>
);
}
Expand Down

0 comments on commit 14d7ca6

Please sign in to comment.