Skip to content

feat: add --accessible flag to huh interactive prompts#455

Open
srtaalej wants to merge 3 commits intomainfrom
ale-accessibility-flag
Open

feat: add --accessible flag to huh interactive prompts#455
srtaalej wants to merge 3 commits intomainfrom
ale-accessibility-flag

Conversation

@srtaalej
Copy link
Copy Markdown
Contributor

Changelog

Added --accessible flag for screen reader friendly prompts

Summary

Related: #454
This PR adds a global --accessible flag that switches huh interactive prompts to accessible mode. In accessible mode, select prompts render as numbered lists with "Enter a number between 1 and N" input, confirm prompts accept y/n text, and input prompts use plain line-by-line I/O. This makes the CLI usable with screen readers by avoiding the TUI-based rendering

Screenshot 2026-03-31 at 4 03 49 PM

Test plan

Run slack create --accessible and verify prompts render as numbered lists
Run slack login --accessible and verify confirm prompt accepts y/n
Run slack create (without flag) and verify normal TUI prompts still work
go test ./internal/iostreams/ -run TestFormsAccessible

Requirements

@srtaalej srtaalej self-assigned this Mar 31, 2026
@srtaalej srtaalej requested a review from a team as a code owner March 31, 2026 20:12
@srtaalej srtaalej added enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment labels Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.05%. Comparing base (5100c02) to head (f39d175).

Files with missing lines Patch % Lines
cmd/root.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #455      +/-   ##
==========================================
- Coverage   71.06%   71.05%   -0.02%     
==========================================
  Files         220      220              
  Lines       18522    18527       +5     
==========================================
+ Hits        13163    13164       +1     
+ Misses       4181     4180       -1     
- Partials     1178     1183       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@srtaalej srtaalej marked this pull request as draft April 1, 2026 15:13
@srtaalej srtaalej marked this pull request as ready for review April 6, 2026 18:28
@srtaalej srtaalej requested a review from zimeg April 6, 2026 18:40
Copy link
Copy Markdown
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srtaalej So amazing to find this feature arriving here! 🍀 ✨

Before approving I want to leave a few comments, but think we can follow up with some other improvements to the edges:

  • Environment Variable: The ACCESSIBLE environment variable is standard I understand and we should include support alongside these changes! This makes preferring these prompts easier with an export added to the shell profile 🔬
  • Blank Selections: The "select" prompts request a number to be entered but accept blank input for the first option! This might be an upstream issue 🐛
  • Input Default: Adjacent for the "input" prompt I find the default value of the create command name isn't showing 🧪

The first note is most important for these changes IMHO! I'd be curious if the latter two can be proven in unit tests, but please don't consider those blocking 🙏

Comment on lines +198 to +206
func Test_AccessibleImpliesNoColor(t *testing.T) {
cfg := &config.Config{Accessible: true}
// Simulate the logic from PersistentPreRunE
if cfg.Accessible {
cfg.NoColor = true
}
assert.True(t, cfg.NoColor, "--accessible should imply --no-color")
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func Test_AccessibleImpliesNoColor(t *testing.T) {
cfg := &config.Config{Accessible: true}
// Simulate the logic from PersistentPreRunE
if cfg.Accessible {
cfg.NoColor = true
}
assert.True(t, cfg.NoColor, "--accessible should imply --no-color")
}

🪓 note: I'm not sure this test is so useful against regressions here?

SlackTestTraceFlag bool
TeamFlag string
TokenFlag string
Accessible bool
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌲 thought: As we're introducing this, should we include the environment variable similar?

ACCESSIBLE

We recommend setting this through an environment variable or configuration option to allow the user to control accessibility.

🔗 https://github.com/charmbracelet/huh?tab=readme-ov-file#accessibility

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 ramble: We might find this adjacent file most useful!

// LoadEnvironmentVariables sets flags based on their environment variable value
func (c *Config) LoadEnvironmentVariables() error {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants