fix(cli): replace dialoguer drop prompt with line-based read for accessibility#4238
Open
BootstrapperSBL wants to merge 1 commit intolaunchbadge:mainfrom
Open
fix(cli): replace dialoguer drop prompt with line-based read for accessibility#4238BootstrapperSBL wants to merge 1 commit intolaunchbadge:mainfrom
BootstrapperSBL wants to merge 1 commit intolaunchbadge:mainfrom
Conversation
…ssibility `sqlx database drop` used dialoguer's raw-mode Y/N toggle, which doesn't echo keypresses and repaints on each press — which screen readers and large-print users find disorienting (see the two failure modes described in launchbadge#4236). Swap to a plain `stdin().read_line` with an explicit `(y/N)` hint: no raw mode, keys echo naturally, and screen readers get a predictable line-at-a-time interaction. `--force` / `-y` / non-TTY paths are unchanged. Closes launchbadge#4236
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces the
dialoguer::Confirmprompt insqlx database dropwith a plainstdin().read_lineso that screen readers, large-print users, and anyone relying on terminal echo get predictable behaviour. Closes #4236.Why
As reported in #4236, the existing prompt uses
dialoguer::Confirmwithwait_for_newline(true). In that mode dialoguer still puts the terminal into raw input for theY/Ntoggle, which causes two separate failure modes:[Y/n]↔[y/N], and screen readers re-parse the full line each time.In both cases the pressed key is never displayed and there's no explicit "press Enter" cue.
What changed
ask_to_continue_dropnow writes the prompt with an explicit(y/N)hint and reads a line from stdin.RestoreCursorGuardis gone because the cursor is never hidden.--force/-y/ non-TTY behaviour is unchanged (only the interactiveconfirm=truepath is touched).A small pure
parse_drop_responsehelper is introduced and unit-tested so the accept/reject matrix is exercised in CI.Before / After
Before (wrapped prompt, with a screen reader):
After:
Keypress echoes, Enter commits, screen readers announce just the single line.
Test plan
cargo fmt --all -- --checkcargo clippy --manifest-path sqlx-cli/Cargo.toml -- -D warningscargo test --manifest-path sqlx-cli/Cargo.toml(3 unit + 8 add + 3 migrate tests pass)echo y | cargo run -- database drop -D sqlite://test.dbproceeds;echo nand empty input abort.