Closed Bug 1804353 Opened 1 year ago Closed 1 year ago

Clicking the block or result menu button with a valid page proxy state makes the page proxy state invalid

Categories

(Firefox :: Address Bar, defect, P2)

defect

Tracking

()

VERIFIED FIXED
110 Branch
Tracking Status
firefox110 --- fixed
firefox111 --- verified
firefox112 --- verified

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

STR

  1. Enable browser.urlbar.resultMenu, or add block buttons to top sites results, or add a provider for empty search strings whose results include block buttons
  2. Open http://example.com/ in a new tab (any URL will do)
  3. Click in the urlbar to show the top sites view
  4. Click a result menu button or block button

On mouseup, the page proxy state becomes invalid and whatever is in the input becomes the search string, so if you click in the urlbar again, you get a search for that search string instead of the top sites.

This happens because on mouseup the view calls #selectElement(null), which updates the input.

Adding { updateInput: false } to the call fixes the problem for the result menu button, but for the block button, it reveals another problem where the input value is set to the URL of the next row but no row is visually selected. That happens because of two things: (1) the input value is set due to onQueryResultRemoved() setting the selected row index to the index of the row after the removed row -- so far so good -- but then (2) the #selectElement(null) inside on_mouseup() is reached and the selecton is cleared.

This is a problem for the weather suggestion since it will have a block button and it's shown in the top sites view. All this logic is surprisingly complex and kind of brittle and I think it would be simplest to just not select buttons when they're clicked.

This stops selecting buttons on mousedown so that selection and the input remain
in a sensible state after clicking the block button while top sites are showing
(e.g., in the weather suggestion).

This turned out to be surprisingly complicated, so please see the bug and code
comments for details. I think our selection logic is pretty brittle or at least
convoluted and could stand to be simplified, but I didn't want to make large
changes here. Ideally we wouldn't treat buttons any differently on mousedown --
so we'd select them too -- and it may be possible to do that while avoiding the
problems I talk about in the bug, but I don't think it's at all worth the
complexity that seems to be required.

I added a new task to the test Daisuke created in D155812.

Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e0ae36457887
Don't select buttons on mousedown in the urlbar view. r=dao
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
Blocks: 1815018

I've managed to reproduce the issue with Fx 109.0a1.
The issue is verified fixed using Fx 112.0a1 and Fx 111.0b3 on Windows 10 and Ubuntu 22.04. The input in the URLbar is no longer transformed into a search string when the result menu button is clicked. This was tested using the result menu button from the weather suggestion feature.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: