Search terms go through the URL formatter
Categories
(Firefox for Android :: Toolbar, defect)
Tracking
()
People
(Reporter: michel, Unassigned)
References
Details
Attachments
(1 file)
|
402.38 KB,
image/png
|
Details |
When using search, the URL is set to the search term in https://searchfox.org/mozilla-central/source/mobile/android/android-components/components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt#64 and goes through https://searchfox.org/mozilla-central/source/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt#120 and through the URL formatter (URLStringUtils.toDisplayUrl) in https://searchfox.org/mozilla-central/source/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt#524
Expected behavior
Search terms should not go through the URL formatter. Maybe the URL fomatter should be integrated into the URLRenderer.
Actual behavior
Search terms are passed through the URL formatter that modifies the way in which they are displayed.
Comment 1•10 months ago
|
||
The severity field is not set for this bug.
:royang, could you have a look please?
For more information, please visit BugBot documentation.
Updated•10 months ago
|
| Reporter | ||
Comment 2•10 months ago
|
||
You can see this issue by following those steps:
- Enter
http:// URI(with the space) in the toolbar - Notice that
URIis displayed and not the full search term.
| Reporter | ||
Comment 3•10 months ago
|
||
Could I get any guidelines on how I should proceed with this issue?
Comment 4•10 months ago
|
||
Agree that this not already being handled in the URLRenderer is a missed opportunity.
Right now, given that we're working to soon replace the toolbar view with a toolbar composable
I think the most straightforward fix would be to expose a new toolbar API for Fenix to use for this specific scenario.
Why:
- search terms are not URLs but rather just the text/query of the previous search in the current tab, see bug 1805164
- since they are not an URL they don't need to go through the
urlFormatter.
What:
- expose a new
text(is this a good name?) API fromToolbar, similar to the currenturlAPI. - this will need a corresponding
textproperty in theDisplayToolbarsimilar to the currenturlproperty. - to limit change and since OriginView is marked as displaying an URL I would suggest not doing any changes here and just using it's
urlAPI exactly as it is to ultimately display the given text.
@Michel does this makes sense?
Also I think I saw this being marked as a potential fix for another ticket, could you add that to the See also of this ticket?
| Reporter | ||
Comment 5•10 months ago
|
||
That seems like a good way to resolve this. However, how would cases where some other code sets text and then gets url or the other way around be handled. Obviously, that shouldn't happen but could due to a bug somewhere else.
Comment 6•10 months ago
•
|
||
I agree that there is a risk in integrators not using the "right" APIs but they would be in full control of the code.
With good documentation, a little attention and some tests (automated + manual) related issue should be avoided.
Think here we want a quick, straightforward fix to test the improvements we expect and then use this as learnings for how to support the same behaviour in the new toolbar based on Jetpack Compose that is soon to replace the toolbar View.
Comment 7•8 months ago
|
||
I am not sure if it should be included here but as discussed in bug 1969937 it would be nice if Android could reuse the code from desktop for not displaying search terms when they might look like URLs.
Comment 8•8 months ago
|
||
(In reply to Simon Friedberger (:simonf) from comment #7)
I am not sure if it should be included here but as discussed in bug 1969937 it would be nice if Android could reuse the code from desktop for not displaying search terms when they might look like URLs.
That seems like a massive project in itself.
Created bug 1978517 to handle discussions and possible work for it.
Comment 9•3 months ago
|
||
The issue reported has been resolved in the composable toolbar (please see the attached screenshot). I'll close this ticket, but please reopen it if the issue still exists.
Updated•3 months ago
|
Description
•