Skip to content

Commit

Permalink
fix(checkbox): optional when the selection is disabled (#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonemeen committed Sep 28, 2022
1 parent 7ac1682 commit 346cf16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/checkbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export default createPrompt(
let newCursorPosition = cursorPosition;
if (isEnterKey(key)) {
setStatus('done');
done(choices.filter((choice) => choice.checked).map((choice) => choice.value));
done(
choices
.filter((choice) => choice.checked && !choice.disabled)
.map((choice) => choice.value)
);
} else if (isUpKey(key) || isDownKey(key)) {
const offset = isUpKey(key) ? -1 : 1;
let selectedOption;
Expand Down

0 comments on commit 346cf16

Please sign in to comment.