Add GeckoView API to clear the text selection
Categories
(GeckoView :: General, enhancement)
Tracking
(firefox69 wontfix, firefox70 fix-optional)
Tracking | Status | |
---|---|---|
firefox69 | --- | wontfix |
firefox70 | --- | fix-optional |
People
(Reporter: rbarker, Assigned: estirling)
References
Details
(Whiteboard: [geckoview:m1909])
Currently there is no way to clear a selection from GeckoView. I believe this functionality is required to to support proper back button functionality in embedding application.s
Comment 1•5 years ago
|
||
related to bug 1570167
Comment 2•5 years ago
|
||
Fenix will need this new API to fix a bug where the back button navigates to the previous page instead of clearing the current text selection:
Comment 3•5 years ago
|
||
The Fenix team considers this bug a P2 because, without this API, Fenix's back button will annoy users by navigating back a page instead of clearing the text selection like Fennec and Chrome do:
https://github.com/mozilla-mobile/fenix/issues/2020#issuecomment-520454212
Reporter | ||
Comment 4•5 years ago
|
||
To be clear, they do not need this to fix the described behavior. Fenix needs to know when the CCP menu is visible and hide it when the back button is pressed. This is something the app needs to do, not GeckoView. GeckoView needs the clear selection API so that the app can clear the selection when it hides the CCP menu. But this feature is not blocking them.
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Adding this bug to GV's September sprint.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
•
|
||
This can be done with no additional API changes.
A SelectionActionDelegate
can know if the CCP menu is visible.
As an example clearSelection
in BasicSelectionActionDelegate
closes the CCP menu and clears selected text. The menu was visible if mResponse is non-null at that time.
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
The current API is quite hard for us to actually use. Maybe we could make it nicer as part of this bug?
In our case we do not want to change any of the implementation and reuse BasicSelectionActionDelegate
. We need to know if a text selection toolbar is showing (internally mResponse != null
) and have a way to clear it (clearSelection()
).
-
(1) One option would be to create those methods or make them accessible so that we can call them by going through
GeckoSession
and the delegate. CurrentlyclearSelection()
isprotected
andmResponse
is not visible. -
(2) As another option we could create our own
SelectionActionDelegate
implementation that delegates to aBasicSelectionActionDelegate
object (which basically means implementing option 1 ourselves). But that is quite hard:BasicSelectionActionDelegate
needs anActivity
that doesn't always exist since it has a different lifecycle. InternallyGeckoView
seems to do some dance to set and clear the delegate depending on whether a session is rendered or released. Replicating this seems quite complicated and error-prone.
Comment 8•5 years ago
|
||
Sending this bug back to GV triage for discussion of Sebastian's suggestions. ^
Comment 9•5 years ago
|
||
Closing again because Elliot says SelectionActionDelegate bug 1581161 will cover Sebastian's suggestions (comment 7).
Comment 10•5 years ago
|
||
Closing again because Elliot says SelectionActionDelegate bug 1581161 will cover Sebastian's suggestions (comment 7).
Description
•