slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.89k stars 562 forks source link

Add support for built-in keypad navigation #6060

Open tronical opened 1 week ago

tronical commented 1 week ago

As a follow-up to https://github.com/slint-ui/slint/discussions/5550 we could add support for the following feature to Slint:

Enyium commented 1 week ago

For this, the behavior of text editors may be relevant when the end user uses vertical arrow keys. States in chronological order with | representing the cursor:

abcd|f
ab
abcdef
abcdef
ab|
abcdef
abcdef
ab
abcd|f

The text editor remembers a "theoretical" (as opposed to practical) horizontal cursor position, and, if no horizontal navigation overrode it, it derives the practical cursor position from the theoretical cursor position on every vertical navigation to a new line.

In the same way, Slint could perhaps remember the position and bounds of the element that it navigated away from, and, if another navigation action is what directly follows, this information is used to determine the most suitable next element to focus to stay on the navigation path as best as possible, even if an intermediately focused element had the potential of leading the navigation path astray.

tronical commented 1 week ago

Excellent idea!