-
Notifications
You must be signed in to change notification settings - Fork 675
ui: Autofocus search input on settings pages #4491
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
Conversation
🎨 Perfetto UI Build✅ UI build is ready: https://storage.googleapis.com/perfetto-ci-artifacts/gh-21373958017-1-ui/ui/index.html |
|
Unfortunately as pages are retained in memory even after switching away (in order to avoid losing things like scroll position), this only works the first time the pages are navigated to, which feels a little janky. I'm not aware of an elegant solution to this problem, but open to suggestions. |
| * Whenever the Page transitions from closed to open, the focus() methods is | ||
| * called. | ||
| */ | ||
| export abstract class FocusPage<T extends FocusPageAttrs> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely not the right place to add this – but this was the easiest for now.
|
Took another stab at this by adding a FocusPage that internally tracks the |
stevegolton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not particularly keen on this approach because:
- Manual drilling of the 'open' state through potentially many layers of components.
- FocusPage needs oncreate and onupdate but it's all to easy to override by mistake in subclases.
- Only works with pages (not subpages, or tabs, which also mostly use Gate to control visibility).
I've been playing around with my take on this problem here: #4603 - I'd be interested to hear your thoughts.
When selecting a search page (flags, plugins or settings) autofocus directly on the search input to required fewer mouse inputs.