Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkbox): Add keyboard handling for Enter and Space keys to tog… (
#946) ### Summary of Changes - Added keyboard functionality to the input component to toggle the checked state when the Enter or Space key is pressed. ### Changes Made 1. Implemented the handleKeyDown function: ``` private handleKeyDown(event: KeyboardEvent) { if (event.code === "Enter" || event.code === "Space") { this.checked = !this.checked; this.onChange(this.checked); event.preventDefault(); } } ``` 2. Associated the function with the @keydown event listener: `<input @keydown=${this.handleKeyDown} />` ### Reason for Changes This change was made to enhance user interaction with form elements via the keyboard and to improve accessibility. --------- Co-authored-by: Buse Selvi <[email protected]> Co-authored-by: Erbil <[email protected]>
- Loading branch information