Skip to content

Commit

Permalink
Set value by keyboard (#81)
Browse files Browse the repository at this point in the history
Moved setValue to input's onChange from the label's onClick. This allows
the user to set the value with either their keyboard or with their
mouse.
  • Loading branch information
kevin-kientopp authored Jan 17, 2023
1 parent af172c0 commit feb07bc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
49 changes: 41 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/SegmentedControlWithoutStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class SegmentedControlWithoutStyles extends Component {
id={getId(option)}
defaultChecked={option.default}
disabled={option.disabled}
onChange={() => this.setValue(option.value)}
/>
))}
{this.props.options.map((option) => (
<label
key={option.value}
onClick={() => this.setValue(option.value)}
htmlFor={getId(option)}
data-value={option.label}
>
Expand Down

0 comments on commit feb07bc

Please sign in to comment.