-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Introduce gh accessibility help topic highlighting GitHub CLI accessibility experiences
#10890
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
274a09b
Initial `gh accessibility` command draft
andyfeller d7e2468
Update a11y text based on draft feedback
andyfeller 096106a
Apply suggestions from code review
andyfeller 2fd1a45
Update pkg/cmd/accessibility/accessibility.go
andyfeller c20138d
Update pkg/cmd/accessibility/accessibility.go
andyfeller 830335d
PR feedback
andyfeller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| package accessibility | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/MakeNowJust/heredoc" | ||
| "github.com/cli/cli/v2/internal/browser" | ||
| "github.com/cli/cli/v2/internal/text" | ||
| "github.com/cli/cli/v2/pkg/cmdutil" | ||
| "github.com/cli/cli/v2/pkg/iostreams" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| const ( | ||
| webURL = "https://accessibility.github.com/conformance/cli/" | ||
| ) | ||
|
|
||
| type AccessibilityOptions struct { | ||
| IO *iostreams.IOStreams | ||
| Browser browser.Browser | ||
| Web bool | ||
| } | ||
|
|
||
| func NewCmdAccessibility(f *cmdutil.Factory) *cobra.Command { | ||
| opts := AccessibilityOptions{ | ||
| IO: f.IOStreams, | ||
| Browser: f.Browser, | ||
| } | ||
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "accessibility", | ||
| Aliases: []string{"a11y"}, | ||
| Short: "Learn about GitHub CLI's accessibility experiences", | ||
| Long: longDescription(opts.IO), | ||
| Hidden: true, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| if opts.Web { | ||
| if opts.IO.IsStdoutTTY() { | ||
| fmt.Fprintf(opts.IO.ErrOut, "Opening %s in your browser.\n", text.DisplayURL(webURL)) | ||
| } | ||
| return opts.Browser.Browse(webURL) | ||
| } | ||
|
|
||
| return cmd.Help() | ||
| }, | ||
| Example: heredoc.Doc(` | ||
| # Open the GitHub Accessibility site in your browser | ||
| $ gh accessibility --web | ||
|
|
||
| # Display color using customizable, 4-bit accessible colors | ||
| $ gh config set accessible_colors enabled | ||
|
|
||
| # Use input prompts without redrawing the screen | ||
| $ gh config set accessible_prompter enabled | ||
|
|
||
| # Disable motion-based spinners for progress indicators in favor of text | ||
| $ gh config set spinner disabled | ||
| `), | ||
| } | ||
|
|
||
| cmd.Flags().BoolVarP(&opts.Web, "web", "w", false, "Open the GitHub Accessibility site in your browser") | ||
| cmdutil.DisableAuthCheck(cmd) | ||
|
|
||
| return cmd | ||
| } | ||
|
|
||
| func longDescription(io *iostreams.IOStreams) string { | ||
| cs := io.ColorScheme() | ||
| title := cs.Bold("Learn about GitHub CLI's accessibility experiences") | ||
| color := cs.Bold("Customizable and contrasting colors") | ||
| prompter := cs.Bold("Non-interactive user input prompting") | ||
| spinner := cs.Bold("Text-based spinners") | ||
| feedback := cs.Bold("Join the conversation") | ||
|
|
||
| return heredoc.Docf(` | ||
| %[2]s | ||
|
|
||
| As the home for all developers, we want every developer to feel welcome in our | ||
| community and be empowered to contribute to the future of global software | ||
| development with everything GitHub has to offer including the GitHub CLI. | ||
|
|
||
| %[3]s | ||
|
|
||
| Text interfaces often use color for various purposes, but insufficient contrast | ||
| or customizability can leave some users unable to benefit. | ||
|
|
||
| For a more accessible experience, the GitHub CLI can use color palettes | ||
| based on terminal background appearance and limit colors to 4-bit ANSI color | ||
| palettes, which users can customize within terminal preferences. | ||
|
|
||
| With this new experience, the GitHub CLI provides multiple options to address | ||
| color usage: | ||
|
|
||
| 1. The GitHub CLI will use 4-bit color palette for increased color contrast based | ||
| on dark and light backgrounds including rendering Markdown based on the | ||
| GitHub Primer design system. | ||
|
|
||
| To enable this experience, use one of the following methods: | ||
| - Run %[1]sgh config set accessible_colors enabled%[1]s | ||
| - Set %[1]sGH_ACCESSIBLE_COLORS=enabled%[1]s environment variable | ||
|
|
||
| 2. The GitHub CLI will display issue and pull request labels' custom RGB colors | ||
| in terminals with true color support. | ||
|
|
||
| To enable this experience, use one of the following methods: | ||
| - Run %[1]sgh config set color_labels enabled%[1]s | ||
| - Set %[1]sGH_COLOR_LABELS=enabled%[1]s environment variable | ||
|
|
||
| %[4]s | ||
|
|
||
| Interactive text user interfaces manipulate the terminal cursor to redraw parts | ||
| of the screen, which can be difficult for speech synthesizers or braille displays | ||
| to accurately detect and read. | ||
|
|
||
| For a more accessible experience, the GitHub CLI can provide a similar experience using | ||
| non-interactive prompts for user input. | ||
|
|
||
| To enable this experience, use one of the following methods: | ||
| - Run %[1]sgh config set accessible_prompter enabled%[1]s | ||
| - Set %[1]sGH_ACCESSIBLE_PROMPTER=enabled%[1]s environment variable | ||
|
|
||
| %[5]s | ||
|
|
||
| Motion-based spinners communicate in-progress activity by manipulating the | ||
| terminal cursor to create a spinning effect, which may cause discomfort to users | ||
| with motion sensitivity or miscommunicate information to speech synthesizers. | ||
|
|
||
| For a more accessible experience, this interactivity can be disabled in favor | ||
| of text-based progress indicators. | ||
|
|
||
| To enable this experience, use one of the following methods: | ||
| - Run %[1]sgh config set spinner disabled%[1]s | ||
| - Set %[1]sGH_SPINNER_DISABLED=yes%[1]s environment variable | ||
|
|
||
| %[6]s | ||
|
|
||
| We invite you to join us in improving GitHub CLI accessibility by sharing your | ||
| feedback and ideas through GitHub Accessibility feedback channels: | ||
|
|
||
| %[7]s | ||
| `, "`", title, color, prompter, spinner, feedback, webURL) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.