Skip to content

Conversation

@elamperti
Copy link

Whenever the listview has require-input set to true, if the user hasn't entered any text, pressing kb-accept will result in the selection of the first item of the list, even if it's not visible for the user. Also trying to navigate the list (blindly) doesn't change the selected item either.

My proposed change prevents auto-selecting the first option blindly, avoiding an unexpected default selection (whatever is the first item in the listview). With this change, rofi remains open until the user either enters the required input and accepts, or presses kb-cancel. This goes in line with the UX of other search/filtering tools, and it should benefit the community users' who use this option.

See more details and ongoing discussion here.

Whenever the listview has require-input set to true, if the user hasn't
entered any text, pressing kb-accept won't have any effect.
This prevents auto-selecting the first option blindly, which may lead to
unexpected selections (as the user can't see the first item of the list).
Comment on lines +580 to +582
if (lv->require_input && !lv->filtered) {
return UINT32_MAX;
}
Copy link
Author

Choose a reason for hiding this comment

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

This is enough to avoid auto-selecting the first item when require_input is enabled and there's no input:

Comment on lines +1731 to +1733
if (selected != UINT32_MAX) {
state->quit = TRUE;
}
Copy link
Author

Choose a reason for hiding this comment

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

And checking the selected value here, before defining it's time to quit, would keep rofi open when require_input is enabled and there's no input. The user can still quit rofi normally by using the expected method, kb-cancel.

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.

1 participant