-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Slider: Do not grab focus on tap event #4376
Conversation
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.
Thanks. I think this makes sense but I'd like to hear someone else's opinion as well.
Agreed. Not sure about check, but would be happy at this time to say Entry is the only one that keeps focus as that is what we seem to have mostly done. |
It might be the case that Radio also keeps focus? |
Anything you touch should have focus, but that focus (outside of specific widgets) should not be visible until either hotkeys ((Shift-)TAB) are hit (in which case it will jump to the previous/next widget). This is also the way browsers do it. |
I think what's happening in that case is it's changing what the next-to-focus widget will be without actually giving any widget focus until (Shift-)TAB is hit. |
I don't think we should have multiple states for focus. If something is focused (can get key signals) then that should be visible.
I could not replicate it with safari - the keyboard support seems less than intuitive (only links got focus, not form elements). The discussion leads me to think that dragging a slider does not give it focus (as you're performing the action, not just switching widget) though it leaves check and radio up for debate. Button too will not take focus just because it's tapped, as the action of tapping is the whole interaction. So maybe checking a check/radio on tap should not give it focus? (Leading back to the idea that Entry is the only one - plus derivatives). |
I think that might be a good idea |
Your action of interacting with an element gives it focus, but does not visually display it as such until the keyboard is used. Here are my tests on on Chromium/Firefox/Edge (might have to enable audio) showing this is the case unless continued input is expected (input fields): This makes sense as your "focus" is currently on the last thing you've interacted with, but because such a low percentage of people would be using both mouse and keyboard for non-entry fields, they hide the visual focus indicator until a keyboard button is hit. I agree with this behaviour as the vast majority of users don't need a constant reminder to know what the last thing they clicked on was (besides entry boxes, as you're expected to continue interacting with it using the keyboard, and need to know where your input will end up!), and when you do end up using the keyboard, it should apply to the last thing you touched. It would be incredibly jarring to be working at the bottom of an application, hit TAB, then have the focus jump to the top of the application. |
I think you might be right about that. It seems like the more anticipated change from the user. Maybe our buttons ought to keep the focus? If that's the case, maybe we ought to have a better API than doing this? driver := fyne.CurrentApp().Driver()
if !s.focused && !driver.Device().IsMobile() {
impl := s.super()
if c := driver.CanvasForObject(impl); c != nil {
c.Focus(impl.(fyne.Focusable))
}
} |
I agree with this statement, but in reference to my prior post this is actually what happens on Safari (macOS). I need a better browser to test against ;). |
What does the discussion mean to the original post? Should the focus be "grabbed" after all but not indicated? |
I understand the discussion here as saying that this PR is doing the exact opposite. We no longer mark the slider widget as the currently focused object when clicking on it. |
As discussed on the call today this requires some exploration to determine what the right overall approach is. |
We seem to be moving toward all input widgets grabbing focus when tapped so closing this |
Hmm, we are currently working on consistency. |
Description:
Do not focus the slider if it is interacted with by a tap event. This is inconsistent with other widgets (button, etc) which only become focused by the focus manager with the tab key. Entry of course grabs focus when tapped, but this is because Entry must be interacted with the keyboard. Tapping or dragging to change a slider value does not imply that the user wants to further control the slider afterward with the keyboard.
Edit: Looks like check keeps focus after tap, and button does not. I think none but Entry should keep focus after a tap, but whichever way we go we should make it consistent
Fixes #4369
Checklist: