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

Text Entry with Suggested Values #123

Open
VisenDev opened this issue Sep 10, 2024 · 3 comments
Open

Text Entry with Suggested Values #123

VisenDev opened this issue Sep 10, 2024 · 3 comments

Comments

@VisenDev
Copy link
Collaborator

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist for example of desired widget behavior

@david-vanderson
Copy link
Owner

Thanks for filing this and for the link! I think we have the pieces needed, I just need to figure out the api.

@VisenDev
Copy link
Collaborator Author

I just need to figure out the api.

Perhaps just add a "suggested values" field to TextEntryWidget.InitOptions?

suggested_values: ?[]const []const u8 = null,

@david-vanderson
Copy link
Owner

What I'd like to do is have the api be more like:

  • make the textEntry
  • make a separate "suggestion dropdown" widget that gets it's location off the textEntry
  • the using code adds suggestions to the list
    • this way the suggestions don't have to be static, and
    • it can dynamically filter based on what's already in the textEntry
    • also the filtering is in the app code not dvui code (but we would offer a built-in one)
  • detect if the user has selected an entry and populate the textEntry with that value

But there are still a lot of unknowns that can only be figured out by going through it:

  • How to know when to show the suggestions dropdown
  • How to make keyboard navigation work (pressing down while in the textEntry should move the focus to the first suggestion?)
  • Can it be a separate widget, or does it need to wrap the textEntry?

I'm sure it'll end up really nice, but it's going to take some time.

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

No branches or pull requests

2 participants