Skip to content

Comments

Add placeholder parameter support to confirm prompt#486

Open
veeceey wants to merge 1 commit intotmbo:masterfrom
veeceey:fix/issue-470-confirm-placeholder
Open

Add placeholder parameter support to confirm prompt#486
veeceey wants to merge 1 commit intotmbo:masterfrom
veeceey:fix/issue-470-confirm-placeholder

Conversation

@veeceey
Copy link
Contributor

@veeceey veeceey commented Feb 8, 2026

Summary

  • Added support for the placeholder parameter to the questionary.confirm() prompt
  • The placeholder text is displayed when no answer has been selected
  • The placeholder disappears once the user presses a key (y/n/Y/N), matching the behavior of other questionary prompts
  • Added comprehensive test coverage for the new functionality

Issue

Fixes #470

Test plan

  • All existing tests pass (165/165)
  • Added two new tests:
    • test_confirm_placeholder: Verifies placeholder parameter is accepted
    • test_confirm_placeholder_disappears_on_input: Verifies placeholder disappears after user input
  • Manual testing confirms the placeholder displays correctly and disappears when typing

Changes

Modified files:

  • questionary/prompts/confirm.py: Added placeholder parameter and logic to display it in the prompt tokens
  • tests/prompts/test_confirm.py: Added test coverage for placeholder functionality

Behavior:

  • Before: Placeholder parameter was ignored in confirm prompts
  • After: Placeholder text displays when no answer is selected and disappears when user types y/n

The confirm prompt now supports an optional placeholder parameter that displays
grayed-out text when no answer has been selected. The placeholder text disappears
once the user presses a key (y/n/Y/N), matching the behavior of other prompts.

This fix ensures consistency across all questionary prompt types.

Fixes tmbo#470
@veeceey
Copy link
Contributor Author

veeceey commented Feb 19, 2026

Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

questionary.confirm with placeholder does not clear the placeholder text

1 participant