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
Fixes on widget.Entry #2068
Fixes on widget.Entry #2068
Conversation
…orColumn and CursorRow with selectColumn and selectRow in DragEnd event
… early return in KeyDown and KeyUp methods if entry is disabled
… are equal to selectRow/selectCol
Lots of great fixes, thanks. I'm not sure about this one:
As that requires we move disabled widgets back into the focus cycle... This seems like an anti-pattern as you should not be able to focus things that cannot be interacted - should you? |
I agree with you, however widget.Entry is a special because it has the disabled state mixed with readonly state. Disabled entry can be interacted (text selection), and if we don't put disabled Entry into the focus cycle, text selection can't be erased on it (one of the current problems). |
This seems like a tap handler issue not a keyboard one. Tapping should clear selection. |
Tapping indeed clears selection, but it only happens if you tap on the disabled entry, if you tap outside of it, you can't clear the selection (current issue). As far as I can see, the only way to clear it, is when Entry loses focus, that is how it works when entry is enabled. |
It's hard to be objective here as I don't really understand the difference between a ReadOnly / Disabled Entry and a Label widget. IMHO it's not terrible that you have to tap the entry to deselect when disabled, as you have to make the selection through taps as well... |
Hmm, considering that label does not have the functionality to select text, it is different from Entry. ReadOnly and Disabled entry are indeed very similar, but the first one should be focused and the last one no. I don't think it is wrong to have only disabled entry, but it should get the same benefits of a readonly entry.
I don't follow that, sorry. That is not the way readonly (disabled here) inputs works, and it leads to a bit confusing interface, look this case: |
I don't think that the difference between read-only and disabled are meaningful.
Apart from using the mouse/touch gestures, how do you select text for a disabled entry? |
I agree with you. This PR does not change the tab-focus-list. It only uses the focus to be able to copy the content and unselect the text when you tap outside, all other characteristics remain the same.
Hmm, maybe I don't write it well, I mean this is not good: disabled-text-selection.mp4A good example of how it should work, is this github conversation, every comment block is readonly and you can select the text, copy it with the keyboard and unselect it when tapping outside. I think that is the behavior final users would expect, don't they? |
I am confused then - how does the top line "Allow copy content from a disabled widget.Entry using the keyboard" work if you are not allowing the entry to be part of the focus list? keystrokes are only sent to the currently focused element.
I disagree - the comment blocks are simple HTML text. On a web page all text is selectable - unlike in an application. I would consider these labels, not read-only entries. Web pages are documents transitioned into an application, whereas fyne apps are apps not documents. I don't think that it's a direct comparison. |
Because the function that allow us to go to the next focusable widget, check again if it is disabled or not: fyne/internal/app/focus_manager.go Lines 117 to 125 in ec5bf01
Oh yes, you are right, sorry for the confusion (I hadn't realized the difference before). After testing some native apps, disabled inputs can't even be selected (I mean the text). However, I wonder if we should go so rigid in that direction. Considering that most of the modern apps are web based (VSCode, Postman, Slack, Discord, MicrosoftTeams, MongoDB Compass...) and final users are familiarized with that kind of applications, don't you think that should be good to adopt part of this behavior to avoid final users get confused? MongoDB Compass example: mongo_select.mp4 |
So to clarify what I think I am beginning to understand: And, if that's correct, then by extension selecting inside a disabled entry will de-focus whatever was focused before? |
Yes, but not all the items, just the Entry or more general the ones which has SelectedText() method.
Yes, that's correct, just like if you tapped outside. |
Thanks for the clarification. I'd like to get @toaster opinion on this as he knows focus really well. |
You're welcome.
Great! :)
Yes, that's right, I have the same feeling at code level, but at final user level I am satisfied 😅.
Initially I tried checking directly for *widget.Entry, but it results in a cyclic import. Then I thought that maybe checking for SelectedText() should be enough, because if a widget has this method it would probably need the same behavior. |
I have added this to today's agenda to chat it through |
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.
Ok I think we’re good. Just needs develop pulled in for the new tests to pass
Description:
Fixes:
Checklist: