Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve distinction bewtween selected and unselected prompt items #811

Merged
merged 2 commits into from May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/green-meals-cough.md
@@ -0,0 +1,5 @@
---
"@changesets/cli": patch
---

Improved accessibility of the CLI prompts by using selected/unselected indicators that don't rely solely on the colors.
1 change: 1 addition & 0 deletions packages/cli/package.json
Expand Up @@ -47,6 +47,7 @@
"@manypkg/get-packages": "^1.1.3",
"@types/is-ci": "^3.0.0",
"@types/semver": "^6.0.0",
"ansi-colors": "^4.1.3",
"chalk": "^2.1.0",
"enquirer": "^2.3.0",
"external-editor": "^3.1.0",
Expand Down
10 changes: 9 additions & 1 deletion packages/cli/src/utils/cli-utilities.ts
Expand Up @@ -3,6 +3,7 @@ import termSize from "term-size";
import { error, prefix, success } from "@changesets/logger";
import { prompt } from "enquirer";
import { edit } from "external-editor";
import { symbols } from "ansi-colors";

// those types are not exported from `enquirer` so we extract them here
// so we can make type assertions using them because `enquirer` types do no support `prefix` right now
Expand Down Expand Up @@ -60,7 +61,14 @@ async function askCheckboxPlus(
choices,
format,
limit,
onCancel: cancelFlow
onCancel: cancelFlow,
symbols: {
indicator: symbols.radioOff,
checked: symbols.radioOn
},
indicator(state: any, choice: any) {
return choice.enabled ? state.symbols.checked : state.symbols.indicator;
}
} as ArrayPromptOptions)
.then((responses: any) => responses[name])
.catch((err: unknown) => {
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Expand Up @@ -1075,6 +1075,11 @@
resolved "https://registry.yarnpkg.com/@changesets/types/-/types-0.4.0.tgz#3413badb2c3904357a36268cb9f8c7e0afc3a804"
integrity sha512-TclHHKDVYQ8rJGZgVeWiF7c91yWzTTWdPagltgutelGu/Psup5PQlUq6svx7S8suj+jXcaE34yEEsfIvzXXB2Q==

"@changesets/types@^4.0.1":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@changesets/types/-/types-4.1.0.tgz#fb8f7ca2324fd54954824e864f9a61a82cb78fe0"
integrity sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==

"@cnakazawa/watch@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef"
Expand Down Expand Up @@ -1920,6 +1925,11 @@ ansi-colors@^4.1.1:
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==

ansi-colors@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b"
integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==

ansi-escapes@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
Expand Down