feat: add --accessible flag to huh interactive prompts#455
feat: add --accessible flag to huh interactive prompts#455
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
zimeg
left a comment
There was a problem hiding this comment.
@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
ACCESSIBLEenvironment variable is standard I understand and we should include support alongside these changes! This makes preferring these prompts easier with anexportadded 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
createcommand 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 🙏
| 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") | ||
| } | ||
|
|
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
🌲 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
There was a problem hiding this comment.
🔍 ramble: We might find this adjacent file most useful!
slack-cli/internal/config/dotenv.go
Lines 23 to 24 in f39d175
Changelog
Added
--accessibleflag for screen reader friendly promptsSummary
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
Test plan
Run
slack create --accessibleand verify prompts render as numbered listsRun
slack login --accessibleand verify confirm prompt accepts y/nRun
slack create(without flag) and verify normal TUI prompts still workgo test ./internal/iostreams/ -run TestFormsAccessibleRequirements