Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cycle combo_box with keybinds #1991

Merged
merged 3 commits into from
Aug 2, 2023
Merged

Conversation

casperstorm
Copy link
Member

A few keybinds optimizations for combo_box:

  1. When pressing at the very first entry you cycle to bottom
  2. When pressing at the very last entry you cycle to top
  3. Add support for Tab and Shift+Tab which does the same as and .

widget/src/combo_box.rs Outdated Show resolved Hide resolved
@hecrj hecrj added feature New feature or request widget labels Jul 31, 2023
@hecrj hecrj added this to the 0.10.0 milestone Jul 31, 2023
Co-authored-by: Héctor Ramón <hector0193@gmail.com>
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks 🎉

@mtkennerly
Copy link
Contributor

Add support for Tab and Shift+Tab which does the same as ↓ and ↑.

Would this interfere with using tab to cycle through elements in a form, when that form includes a combobox?

@hecrj
Copy link
Member

hecrj commented Aug 2, 2023

Add support for Tab and Shift+Tab which does the same as ↓ and ↑.

Would this interfere with using tab to cycle through elements in a form, when that form includes a combobox?

As long as the form handler honors the event::Status, it should be fine. These interactions are capturing the events.

@hecrj hecrj merged commit 1b355f5 into iced-rs:master Aug 2, 2023
9 of 10 checks passed
@mtkennerly
Copy link
Contributor

As long as the form handler honors the event::Status, it should be fine. These interactions are capturing the events.

The fact that they're captured is why I was concerned 😅 If you honor the status, but you generally use tab for focus_next, then how would you cycle focus out of a combobox?

One solution might be:

  • click in combobox -> triggers overlay -> tab cycles through options in overlay
  • escape closes overlay -> tab cycles focus past combobox

However, at the moment, escape also clears the cursor in the combobox and removes focus, so focus_next would lose its place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants