Closed Bug 1667766 Opened 4 years ago Closed 4 years ago

Typing a url and then keyboard navigating search one-offs doesn't properly update the heuristic

Categories

(Firefox :: Address Bar, defect, P3)

defect
Points:
5

Tracking

()

RESOLVED FIXED
84 Branch
Iteration:
84.1 - Oct 19 - Nov 01
Tracking Status
firefox84 --- fixed

People

(Reporter: mak, Assigned: bugzilla)

References

Details

Attachments

(2 files)

Type a url looking string like "mozilla.org", then ALT+UP multiple times to move through search buttons, the heuristic action and icon should be updated, they are not.
I found this while working on bug 1658629, but didn't fix it there because the patch would have frown too much.

It's still an edge case anyway so likely not a show-stopper.

Assignee: nobody → htwyford
Status: NEW → ASSIGNED
Iteration: --- → 84.1 - Oct 19 - Nov 01

The scope of this bug increased significantly as I was working on it. Full details will be in my patch's commit message, but I ended up fixing a few issues to do with one-off selection, refactored UrlbarView._on_SelectedOneOffButtonChanged, and introduced a new mechanism of swapping out the heuristic result. The patch may also need input from a11y.

Points: 2 → 5

This patch fixes a few issues:

  1. When a history result was autofilled, cycling through the engine one-offs would not change its icon (as expected) and cycling through the local one-offs would change its icon, but only to the history icon. This was because UrlbarView._iconForSearchResult was only checking for the result source and wasn't checking that the result was of search type as well. I renamed this method to _iconForResult and fixed that.

  2. Typing a string, alt+arrowing through the one-offs, then pressing Enter flickers the heuristic result. This is because the one-off button is deselected, so we restore the original heuristic result. However, the search mode query also fires at the same time and quickly replaces the heuristic result. I added a check to not restore the original heuristic result in this case, eliminating the flicker.

  3. When a URL result is autofilled and the user alt+arrows through the one-offs, the heuristic result contains the autofilled URL. This does not reflect what happens when the user presses Enter. The result suggests that the URL might be visited, or we might enter search mode with the URL as the search string. In reality, pressing Enter enters search mode with the typed string as the search string. The confusion is made worse by the fact that clicking the heuristic result will visit the URL and not enter search mode. This is resolved by creating a new search-type UrlbarResult and swapping it in as the heuristic result. This way, the Enter and click behaviours are consistent, the result title reflects what will happen on selection, and this fixes the filed bug of replacing the heuristic action text and icon.

This patch also refactors UrlbarView._on_SelectedOneOffButtonChanged. Previously, the main loop bailed early if a local one-off was selected, thus treating local one-offs as if they were very different from engine one-offs. This new flow handles both local and engine one-offs over the course of the same loop. I think it's a bit easier to read and understand.

I checked a11y with this patch applied and things are mostly unchanged from a screen reader perspective. Currently, typing the string "moz", alt+arrowing to the first one-off, then selecting it will create announcements like: "m", "o", "z", "Selection replaced. Google (@google), button", "Selection replaced. moz, Search with Google, edit text". The same annoucements are made with this patch applied. Pressing down arrow (not alt) will announce the second result. Arrowing back up to the heuristic will announce the original autofill result, because the original autofill result has been swapped back in. I'll ping Jamie in the bug once this patch is mature.

This patch fixes two issues:

  1. When a history result was autofilled, cycling through the engine one-offs would not change its icon (as expected) and cycling through the local one-offs would change its icon, but only to the history icon. This was because UrlbarView._iconForSearchResult was only checking for the result source and wasn't checking that the result was of search type as well. For consistency, we no longer change the icon when local one-offs are selected (we will change it once we figure out a way to change it for engine one-offs as well). I also renamed this method to _iconForResult to prep for Part 2 of this patch.

  2. Typing a string, alt+arrowing through the one-offs, then pressing Enter flickers the heuristic result. This is because the one-off button is deselected, so we restore the original heuristic result. However, the search mode query also fires at the same time and quickly replaces the heuristic result. I added a check to not restore the original heuristic result in this case, eliminating the flicker.

This patch also refactors UrlbarView._on_SelectedOneOffButtonChanged. Previously, the main loop bailed early if a local one-off was selected, thus treating local one-offs as if they were very different from engine one-offs. This new flow handles both local and engine one-offs over the course of the same loop. I think it's a bit easier to read and understand.

Attachment #9182981 - Attachment description: Bug 1667766 - Update URL heuristic results when cycling through one-offs. r?adw! → Bug 1667766 - Part 2 - Restyle URL heuristic results as search results when cycling through one-offs. r?adw!
Pushed by htwyford@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/169e2f4d602d Part 1 - Refactor UrlbarView._on_SelectedOneOffButtonChange and fix one-off selection papercuts. r=adw https://hg.mozilla.org/integration/autoland/rev/da718fa047be Part 2 - Restyle URL heuristic results as search results when cycling through one-offs. r=adw
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
Regressions: 1674485
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: