Commit graph

132 commits

Author SHA1 Message Date
Drew Willcoxon
b97ac7a1cf Bug 1851940 - Enable addon suggestions by default with treatment B (no stars) for all Suggest users. r=daisuke
This enables addon suggestions by default (treatment B, no stars) for all
Suggest users. As discussed on Slack, I did not remove the related prefs and
Nimbus variables in case something goes wrong and we need to disable the feature
ASAP. In that case, we can ship a Nimbus rollout to re-disable it. After a
release cycle or two without any problems, we can do a follow-up that removes
them. I also left the treatment A implementation. We can remove that in a
follow-up too.

Since I did leave the prefs and variables, I only had to change their default
values to enable the feature with treatment B.

One problem is that addon suggestions should be best matches, but we don't want
to set `bestMatch.enabled` to true by default. To work around that, I set the
related best-match properties on the `UrlbarResult` inside `AddonSuggestions`
instead of delegating it to the quick suggest provider. Product has requested
that we remove the "Top pick" checkbox from about:preferences, and at that time
we should also remove the `bestMatch.enabled` pref. In the future, results
should be best matches on a case-by-case basis.

This makes a few UI changes that aren't strictly related but I wanted to fix
since more users will now see these suggestions:

* Cache the "Firefox extension" group label to prevent pop-in.
* Align the URL and row title by baseline. Right now the URL is too high above
  the title.
* Set `inline-margin-end` of the icon so it's symmetrical with the starting
  margin/padding. The current value of 8px is hardcoded and too small.

Differential Revision: https://phabricator.services.mozilla.com/D187640
2023-09-07 05:04:06 +00:00
Dale Harvey
6a30a8ed22 Bug 1848048 - Add a result menu to disable trending results. r=dao,fluent-reviewers,settings-reviewers,flod,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D187066
2023-09-01 08:38:54 +00:00
Dão Gottwald
2e7156a558 Bug 1850502 - Make isurl a standard boolean attribute and rename to is-url. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D187030
2023-08-31 09:31:06 +00:00
Dão Gottwald
f3227a9fe7 Bug 1850133 - Make has-action a standard boolean attribute. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D186845
2023-08-29 03:23:45 +00:00
Dão Gottwald
9aa05e008f Bug 1850132 - Use CSS nesting for rich results. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D186844
2023-08-29 03:22:27 +00:00
Daisuke Akatsuka
572b216bbf Bug 1847475: Implement the result menu for MDN suggestions r=adw,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D185523
2023-08-10 07:37:21 +00:00
Dão Gottwald
a292492244 Bug 1846765 - Various code style fixes. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D185262
2023-08-07 10:01:12 +00:00
Daisuke Akatsuka
e46ae42d9a Bug 1846915: Use a different 'Top pick' group label for MDN suggestions r=adw,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D185249
2023-08-04 13:29:08 +00:00
Daisuke Akatsuka
d699e6a350 Bug 1846907: Limit the description text to 2 or 3 lines r=desktop-theme-reviewers,adw,dao
Differential Revision: https://phabricator.services.mozilla.com/D185247
2023-08-04 13:21:14 +00:00
Drew Willcoxon
7121a1965b Bug 1846765 - Avoid using -moz-bool-pref CSS for experiments. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D185204
2023-08-03 01:06:02 +00:00
Karandeep
1643d58b56 Bug 1842230 - URL bar suggested action for paste when clipboard contains valid URL. r=mak,flod
Differential Revision: https://phabricator.services.mozilla.com/D183747
2023-08-01 11:51:59 +00:00
Marco Bonardo
1fa445c504 Bug 1843100 - Address Bar view should not try to reuse rows from different providers. r=daleharvey
Different providers have different time characteristics, reusing results across
providers may thus cause flicker of results coming from the fastest ones.

Differential Revision: https://phabricator.services.mozilla.com/D183507
2023-07-19 07:43:40 +00:00
Mark Banner
182b6db303 Bug 1792824 - Convert ObjectUtils.jsm to an ES module. r=barret,necko-reviewers,devtools-reviewers,kershaw
Depends on D183308

Differential Revision: https://phabricator.services.mozilla.com/D183309
2023-07-12 08:07:23 +00:00
Drew Willcoxon
85edb0cf2a Bug 1841409 - Create new row content as necessary to make sure the Feedback button is shown. r=dao
Depends on D182537

Differential Revision: https://phabricator.services.mozilla.com/D182625
2023-07-05 18:24:57 +00:00
Stanca Serban
60bb6b1b9f Backed out changeset 5cf32b0ba18a (bug 1841409) for causing mochitests failures. CLOSED TREE 2023-07-06 01:30:56 +03:00
Drew Willcoxon
e3d7e9a498 Bug 1841409 - Create new row content as necessary to make sure the Feedback button is shown. r=dao
Depends on D182537

Differential Revision: https://phabricator.services.mozilla.com/D182625
2023-07-05 18:24:57 +00:00
Drew Willcoxon
41dcc16398 Bug 1841447 - Change the "Top pick" label to "Recommended reads" for Pocket suggestions. r=daisuke,fluent-reviewers,flod
Depends on D182634

Differential Revision: https://phabricator.services.mozilla.com/D182635
2023-07-05 15:47:25 +00:00
Drew Willcoxon
036b13835f Bug 1841446 - Update the "Not interested" command to disable Pocket suggestions. r=daisuke,fluent-reviewers,flod
Depends on D182606

Differential Revision: https://phabricator.services.mozilla.com/D182634
2023-07-05 15:47:24 +00:00
Drew Willcoxon
ce2ff6f009 Bug 1841408 - Unify rich suggestions, best match, Firefox Suggest sponsored results, and Pocket Suggestions. r=dao,daleharvey
This does a few things:

* Unify the view implementations of rich suggestions, Firefox Suggest sponsored
  results, and best match. I did this by using the best match implementation
  and extending it to rich suggestions and Suggest sponsored.
* Use the unified implementation for Pocket suggestions too.
* Add a bottom-text concept since Pocket suggestions shown as top picks need to
  show both a description and some text below it. (The actual bottom text per
  result is added in D182632 since I didn't want to make this patch bigger than
  necessary)

I have a couple motivations for these changes:

* I'm implementing Pocket suggestions, which need to show some text below the
  suggestion title as well as the URL. I was going to just use the Firefox
  Suggest sponsored approach, where the action text is wrapped below the title,
  but that doesn't work because it can't show both the wrapped action text and
  the URL.
* IMO we should use rich suggestions as the basis for all rows going forward,
  i.e., unify the different row implementations around rich suggestions.

The reason I chose the best match implementation instead of the rich suggestions
implementation is because the grid-based approach of rich suggestions doesn't
work well when the URL also needs to be shown. The URL should be
baseline-aligned with the row title, which isn't easy to do when the URL is
outside the grid. The rich suggestions implementation also doesn't wrap the URL.

Other details:

* The `rich-suggestion=no-icon` attribute value is only used for styling, so we
  can replace it with `@supports -moz-bool-pref()`. That lets us make the
  `rich-suggestion` attribute a simple boolean.
* I kept the `isBestMatch` property for results since
  `searchEngagementTelemetryGroup()` uses it to return "top_pick", and the view
  also uses it to create the "Top pick" row/group label. It still has semantic
  meaning so I think that's OK. It's no longer used by the view to create
  different DOM or styling.
* Move `isRichSuggestion` from the payload to the result itself, since it's no
  longer used for only one type of result. It's like `isBestMatch`, which is
  also on the result.
* Add `richSuggestionIconSize` to the result too. The best match icon size
  is 52. The Pocket best match icon size is 24 (but will have added padding and
  a background color to make it appear 52px). IMO this is better than adding
  rules for each type of suggestion to the CSS. It's cleaner and also indicates
  what the "standard" icon sizes are.

Depends on D182580

Differential Revision: https://phabricator.services.mozilla.com/D182537
2023-07-05 15:47:24 +00:00
Drew Willcoxon
6192a3003f Bug 1841354 - Always remove the feedback acknowledgment when a row is updated. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D182608
2023-07-03 21:00:25 +00:00
Katherine Patenio
130ce23c4c Bug 1834831 - update imports of browser/modules JSMs r=webdriver-reviewers,perftest-reviewers,zeid,extension-reviewers,settings-reviewers,pip-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,sessionstore-reviewers,tabbrowser-reviewers,whimboo,mhowell,sgalich,robwu,sparky,Standard8,mconley,dao,sclements
Differential Revision: https://phabricator.services.mozilla.com/D179169
2023-06-19 18:44:48 +00:00
Cristian Tuns
110cfccc1f Backed out 2 changesets (bug 1834831) for causing node failures with checkBundles CLOSED TREE
Backed out changeset 58b351a155c8 (bug 1834831)
Backed out changeset 1acbb5231d14 (bug 1834831)
2023-06-19 13:22:35 -04:00
Katherine Patenio
a73f6ec769 Bug 1834831 - update imports of browser/modules JSMs r=webdriver-reviewers,perftest-reviewers,zeid,extension-reviewers,settings-reviewers,pip-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,sessionstore-reviewers,tabbrowser-reviewers,whimboo,mhowell,sgalich,robwu,sparky,Standard8,mconley,dao,sclements
Differential Revision: https://phabricator.services.mozilla.com/D179169
2023-06-19 16:46:18 +00:00
Mark Banner
ae619c5049 Bug 1838155 - Clean up some console.error calls that had been migrated from Cu.reportError. r=jdescottes,perftest-reviewers,geckoview-reviewers,credential-management-reviewers,search-reviewers,sgalich,owlish,jteow,sparky
This goes through the previous changes in the dependencies of bug 877389, and does two things:
1) Remove instances of \n
2) Change reporting of exceptions so that they are passed as separate arguments. This should result
   in an improved display of the exception in the browser console, should it occur.

Differential Revision: https://phabricator.services.mozilla.com/D180843
2023-06-15 08:33:57 +00:00
Daisuke Akatsuka
9a18396870 Bug 1835227: Clear selected element without updating urlbar when mouseup r=adw
Differential Revision: https://phabricator.services.mozilla.com/D180892
2023-06-14 22:15:26 +00:00
Drew Willcoxon
cd732d535b Bug 1836903 - Implement Pocket suggestions. r=daisuke,desktop-theme-reviewers,dao
This implements most parts of Pocket suggestions. They don't need any special UI
or a dynamic result type because they're only shown as the usual best match rows
or non-best match rows.

Still to do:

* Implement the "Show less frequently" behavior once we decide what the keywords
  will be and how that will work.
* Implement the bottom "Mozilla Pocket" text inside the suggestion row once it's
  finalized. We can use the same technique we use to show the "Sponsored" bottom
  text for adM suggestions.

Other changes this makes:

* Replace the `type=bestmatch` attribute with an `bestmatch` attribute. That
  lets best-match rows have a `type` too, in this case `"pocket"` (actually
  either `"rs_pocket"` or `"merino_pocket"`, since I'm using the telemetry
  result type).
* Improve how UrlbarProviderQuickSuggest delegates to individual features when
  getting result commands, view updates, handling commands, etc., so that we
  don't need to add new `case` statements for each new type of suggestion.

Differential Revision: https://phabricator.services.mozilla.com/D180059
2023-06-07 20:19:44 +00:00
Drew Willcoxon
8db1544e60 Bug 1836585 - Change the "Top pick" label to "Firefox extension" for addon suggestions. r=daisuke,fluent-reviewers,flod
This uses the new label but only when the addon suggestion is shown as a best
match. Otherwise the suggestion will be shown in the usual Firefox Suggest group
so it should use that label.

I chose `-brand-product-name`, which is always "Firefox" even on Nightly. I
don't think it makes sense to talk about "Nightly extensions".

Differential Revision: https://phabricator.services.mozilla.com/D179868
2023-06-05 21:01:32 +00:00
mcheang
50ce5c5c74 Bug 1648188 - Fix SearchService init failures so that the address bar can be used to search history and bookmarks. r=Standard8,mak
This patch refactors the SearchService private initialized variables and how
the SearchService stores its initialization status. These changes capture whether
the SearchService has succeeded, failed or hasn't finished initialization yet.

There are also changes made to UrlbarSearchUtils on handling when SearchService
has failed to initialize or when it hasn't finished initializing yet and we wait.
In the case where the SearchService has failed on initialization, We allow
the code to continue so that it can reach UrlbarProviderPlaces. Once we
are able to reach UrlbarProviderPlaces, we can make database calls for the user's
history and bookmarks. This allows the user to interact with the addressbar and
search their history and bookmarks even if SearchService has failed to initialize.

Differential Revision: https://phabricator.services.mozilla.com/D176936
2023-05-30 18:34:51 +00:00
Dale Harvey
77a2cb0f22 Bug 1832518 - Show overflow fade when rich suggestions are cropped. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D178600
2023-05-23 14:42:59 +00:00
Drew Willcoxon
28dcc91eb2 Bug 1833161 - Properly restore selection when showing the dismissal acknowledgment tip. r=ahal,dao
The problem is the row remains selected after its content is replaced with the
dismissal acknowledgment tip. This patch clears the selection and selects the
tip's "Got it" button if the row was selected.

I didn't add a general browser test for feedback and dismissal acknowledgments
earlier, so I added one now. I cp'ed the weather test and used it as a starting
point since it does test the acknowledgments but is specific to the weather
suggestion. Even though some of it now duplicates the new test, I left it intact
because we still need a test for the weather-specific commands, and the amount
of duplicated code isn't very much.

I modified the test helper function that opens the result menu so that the row
is not selected when `byMouse` is true. That way I can make sure the selection
doesn't change when the dismissed row is not selected. I used
`EventUtils.promiseElementReadyForUserInput()` to synthesize a mousemove over
the row to make the menu button visible. That function has a bug where the
interval is added after `onHit` is called and the promise is resolved, leaving
the interval ticking forever. Moving the `synthesizeMouseAtCenter()` after the
timeout is created fixes the problem.

Differential Revision: https://phabricator.services.mozilla.com/D178264
2023-05-19 22:13:10 +00:00
Daisuke Akatsuka
989c33ea72 Bug 1833966: Show Firefox Suggest row label when best match is not enabled r=adw
Differential Revision: https://phabricator.services.mozilla.com/D178488
2023-05-19 04:53:03 +00:00
Drew Willcoxon
929e1e4d77 Bug 1831760 - Use a native popup menu for positioned popups on Mac. r=dao,mstange
This does two things:

* Modify `nsXULPopupManager::ShowPopup()` so it calls `ShowPopupAsNativeMenu()`
  as long as an anchor wasn't passed in, and only on Mac.
* Modify `-[MOZMenuOpeningCoordinator _openMenu:atScreenPosition:forView:withAppearance:]`
  so it also takes a `aIsContextMenu` param. If the param is true, we synthesize
  a right-click event and pop up a context menu as usual. If it's false, we use
  `-[NSMenu popUpMenuPositioningItem:atLocation:inView:]` instead.

The reason this works is because `-[NSMenu popUpMenuPositioningItem:atLocation:inView:]`
opens the menu in a sensible place when the x-y coords are near the right edge
of the screen. In contrast, `+[NSMenu popUpContextMenu:withEvent:forView:]` will
anchor the menu's top-right corner to the mouse cursor when near the right edge.

Differential Revision: https://phabricator.services.mozilla.com/D177355
2023-05-18 05:51:19 +00:00
Drew Willcoxon
349bbf0963 Bug 1832826 - Add a way to invalidate cached result menu commands and use it when the weather min keyword length cap is reached. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D177954
2023-05-18 02:23:07 +00:00
Dale Harvey
706db5368c Bug 1826447 - Initial support for Rich Suggestions. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D174693
2023-05-11 21:27:36 +00:00
Drew Willcoxon
f0aa29816e Bug 1832105 - Add the weather suggestion commands to the isSessionOngoing logic in the urlbar telemetry event code. r=daisuke
The problem is the two weather commands that keep the view open,
"inaccurate_location" and "show_less_frequently", aren't included in the
criteria that set `isSessionOngoing` to true.

As the comment above `isSessionOngoing` says, we should find a better way to
determine whether the session remains ongoing than hardcoding a list of
commands. I didn't try to do that here since we're time constrained and need to
uplift this to 114.

Differential Revision: https://phabricator.services.mozilla.com/D177558
2023-05-10 03:28:10 +00:00
Drew Willcoxon
3545495040 Bug 1831971 - Remove zero-prefix functionality from the weather suggestion and don't start fetches until a config is set. r=daisuke
This fixes the bug by not starting fetches until a config is set from either
remote settings or Nimbus. By "config" I mean keywords basically, but we sync
more than keywords -- the min keyword length and min keyword length cap -- so
that's why I use different term. So, before remote settings is synced, no config
will be set, so no fetches will happen, so the suggestion will be null. When the
urlbar provider starts a query, it will see the suggestion is null and not add a
result. Once a config is set from RS or Nimbus, we'll start fetching.

Currently we allow zero prefix when keywords or the min keyword length aren't
set. This patch removes that functionality because on second thought, there's
not a safe and obvious way to support zero prefix using these keyword-related
config properties/variables by themselves, and zero prefix isn't a feature
requirement anymore anyway. If we wanted to keep supporting it with these
properties/variables, there are a few options, and I don't like any of them:

* If `keywords` is undefined or null, use zero prefix. This is dangerous because
  we may make a mistake in RS or Nimbus and forget to set it. Also, we use null
  as the default value for the Nimbus var, and since we use UrlbarPrefs to
  access Nimbus vars, there's no good way to tell whether null was set
  intentionally or not.
* If `keywords` is an empty array, use zero prefix. This is awkward because the
  user can now increment the min keyword length, which means the keywords array
  kept by `Weather` can become empty when the min keyword length is incremented
  a lot. In that case, no suggestion should be shown at all.
* If `min_keyword_length` is zero/falsey, use zero prefix. This has the same
  problems as the first point above.

If we do need to support zero prefix again in the future, I think we should add
an RS property/Nimbus variable that makes it clear what's happening, e.g., a
`useZeroPrefix` boolean.

I removed the exposure scalar because it's entirely based on zero prefix. We can
use Glean for that now anyway.

I also noticed weather suggestions are case insenstive, so I fixed that and
added a test task.

Differential Revision: https://phabricator.services.mozilla.com/D177448
2023-05-09 06:37:34 +00:00
Norisz Fay
5cf0725f32 Backed out changeset a39f9cd81a42 (bug 1831971) for causing bc failures on browser_glean_telemetry_engagement_selected_result.js CLOSED TREE 2023-05-09 09:14:25 +03:00
Drew Willcoxon
1ab4707494 Bug 1831971 - Remove zero-prefix functionality from the weather suggestion and don't start fetches until a config is set. r=daisuke
This fixes the bug by not starting fetches until a config is set from either
remote settings or Nimbus. By "config" I mean keywords basically, but we sync
more than keywords -- the min keyword length and min keyword length cap -- so
that's why I use different term. So, before remote settings is synced, no config
will be set, so no fetches will happen, so the suggestion will be null. When the
urlbar provider starts a query, it will see the suggestion is null and not add a
result. Once a config is set from RS or Nimbus, we'll start fetching.

Currently we allow zero prefix when keywords or the min keyword length aren't
set. This patch removes that functionality because on second thought, there's
not a safe and obvious way to support zero prefix using these keyword-related
config properties/variables by themselves, and zero prefix isn't a feature
requirement anymore anyway. If we wanted to keep supporting it with these
properties/variables, there are a few options, and I don't like any of them:

* If `keywords` is undefined or null, use zero prefix. This is dangerous because
  we may make a mistake in RS or Nimbus and forget to set it. Also, we use null
  as the default value for the Nimbus var, and since we use UrlbarPrefs to
  access Nimbus vars, there's no good way to tell whether null was set
  intentionally or not.
* If `keywords` is an empty array, use zero prefix. This is awkward because the
  user can now increment the min keyword length, which means the keywords array
  kept by `Weather` can become empty when the min keyword length is incremented
  a lot. In that case, no suggestion should be shown at all.
* If `min_keyword_length` is zero/falsey, use zero prefix. This has the same
  problems as the first point above.

If we do need to support zero prefix again in the future, I think we should add
an RS property/Nimbus variable that makes it clear what's happening, e.g., a
`useZeroPrefix` boolean.

I removed the exposure scalar because it's entirely based on zero prefix. We can
use Glean for that now anyway.

I also noticed weather suggestions are case insenstive, so I fixed that and
added a test task.

Differential Revision: https://phabricator.services.mozilla.com/D177448
2023-05-09 04:28:47 +00:00
Drew Willcoxon
984b5d9552 Bug 1831657 - Implement the "Show less frequently" weather suggestion command. r=daisuke
This increments the minimum keyword length when the user clicks the "Show less
frequently" command for the weather suggestion. It adds a pref to keep track of
the current min length. If the pref is zero, we use the min length in Nimbus or
remote settings.

There is a limit to the number of times "Show less frequently" can be clicked.
This patch calls it the cap. Once the cap is reached, the min length can't be
incremented any more and the command is not shown in the menu again. The cap can
be set in Nimbus and remote settings.

This patch also modifies UrlbarPrefs by making it possible to remove observers.
`Weather` needs to listen for changes to the `weather.minKeywordLength` pref,
and when the weather feature is disabled, it needs to stop listening.

Depends on D175827

Differential Revision: https://phabricator.services.mozilla.com/D177218
2023-05-08 09:08:43 +00:00
Drew Willcoxon
79dcb5721b Bug 1830385 - Implement the dismissal "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This implements the second "thanks for your feedback" UI for weather, Pocket,
addon, MDN, etc. suggestions. The first UI is in D175729, which this revision
builds on.

This UI is shown when a result is dismissed. It's essentially a tip with a
smaller icon and padding. It has the "Got it" button that dismisses the tip
itself when clicked.

I noticed tip top and bottom borders use `--panel-separator-color`, which
doesn't seem right. They're supposed to be the same color as the borders between
the input and view and between the results and one-off buttons, which is
`--autocomplete-popup-separator-color`. The spec for this feature uses the same
colors too. So I changed that too. (The use of `--panel-separator-color` goes
back to [the initial tip implementation](https://hg.mozilla.org/mozilla-central/rev/78886081d45b09987c1825cc5a160fd6bec61cb8) in 70, but search tips and
interventions weren't added until 74, in bug 1606909 and bug 1606917. I checked,
and in 74 all the borders are the same color.)

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D175729

Differential Revision: https://phabricator.services.mozilla.com/D176468
2023-05-02 20:15:18 +00:00
Norisz Fay
526cf3b67c Backed out changeset d09e87ed0a41 (bug 1830385) for causing xpcshell failures on test_weather.js CLOSED TREE 2023-05-02 22:05:41 +03:00
Drew Willcoxon
7e5234932a Bug 1830385 - Implement the dismissal "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This implements the second "thanks for your feedback" UI for weather, Pocket,
addon, MDN, etc. suggestions. The first UI is in D175729, which this revision
builds on.

This UI is shown when a result is dismissed. It's essentially a tip with a
smaller icon and padding. It has the "Got it" button that dismisses the tip
itself when clicked.

I noticed tip top and bottom borders use `--panel-separator-color`, which
doesn't seem right. They're supposed to be the same color as the borders between
the input and view and between the results and one-off buttons, which is
`--autocomplete-popup-separator-color`. The spec for this feature uses the same
colors too. So I changed that too. (The use of `--panel-separator-color` goes
back to [the initial tip implementation](https://hg.mozilla.org/mozilla-central/rev/78886081d45b09987c1825cc5a160fd6bec61cb8) in 70, but search tips and
interventions weren't added until 74, in bug 1606909 and bug 1606917. I checked,
and in 74 all the borders are the same color.)

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D175729

Differential Revision: https://phabricator.services.mozilla.com/D176468
2023-05-02 16:50:43 +00:00
Drew Willcoxon
dee2fdb89c Bug 1830383 - Implement "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This builds on D174994 and implements the "thanks for your feedback" message
shown inside a Suggest result when the user gives feedback on it without
dismissing it. This applies to weather suggestions, addons, Pocket, etc. The
implementation is very similar to the implementation of row/group labels.

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D174994

Differential Revision: https://phabricator.services.mozilla.com/D175729
2023-05-02 16:09:20 +00:00
Drew Willcoxon
0fe34d691a Bug 1828955 - Implement "Feedback" result menu button for weather suggestions. r=dao,bolsson
This makes the following changes to the result menu button for weather results:

* Add a "Feedback" label
* Make it always visible

We may want to use this feedback button for other types of results, so I added a
generalized way for results to opt into it, `result.showFeedbackMenu`.

See [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=YUIAppzynd5ZmIew-1)

Differential Revision: https://phabricator.services.mozilla.com/D175922
2023-04-25 16:33:37 +00:00
Wil Stuckey
00a302fc9e Bug 1819766 - Add support for exposure based experiments. r=adw
This change adds support for exposure based experiments by allowing
a Nimbus variable/pref to specify the urlbar provider that should
trigger an exposure event as well as a secondary boolean variable/pref
that controls the visibility of the exposed result. The exposure should
be registered when a result 'can be added' but may or may not be shown
based on the value of the `displayExposureProvider` variable.

* Add exposure event to metrics.yaml
* Add new Nimbus variable (`exposureProvider`) to specify the urlbar
  providers that should trigger exposure events .
* Add new Nimbus variable (`displayExposureProvider`) that controls the visibility
  of the provider results that matched the `exposureProvider` variable.

Differential Revision: https://phabricator.services.mozilla.com/D174209
2023-04-24 20:04:21 +00:00
Drew Willcoxon
d460aa0c8d Bug 1828960 - Don't remove the "open" attribute on the result menu button when a submenu closes. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D175928
2023-04-20 18:32:21 +00:00
Drew Willcoxon
6829a78aa2 Bug 1827943 - Implement the weather suggestion result menu UI. r=dao,fluent-reviewers,flod
This implements the weather suggestion result menu UI and builds on D174941.
References:

* [Spec]( https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=29w6wH3UYchqBxqX-1) (See "A11y review" in the sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (See "Revised 4/3" in the sidebar)

There are a couple important points about the menu. First, one of the commands,
"Report inaccurate location", is specific to weather suggestions, or at least
location-based suggestions. I don't think it's a good idea to centralize all
commands in UrlbarView, and in general I'd like to stop centralizing handling of
different result types in the view and input, so I added a new provider method
called `getResultCommands()`.

Second, the spec calls for a menu separator and a submenu so the user can select
a reason they don't want to see the result, so the return value of
`getResultCommands()` is flexible enough to support those two things, and I
modified `#populateResultMenu()` too.

These new commands will be recorded in Glean engagement telemetry as new
`engagement_type` values, same as "dismiss" and "help" currently are.

This patch doesn't implement handling of two of the commands, "Report inaccurate
location" and "Show less frequently", because I wanted to keep it focused on the
fundamentals described above.

Depends on D174941

Differential Revision: https://phabricator.services.mozilla.com/D174994
2023-04-18 16:22:56 +00:00
Drew Willcoxon
a3b0a1fd4c Bug 1827762 - Replace UrlbarProvider.pickResult() and blockResult() with onEngagement() r=mak
This removes `UrlbarProvider.pickResult()` and `blockResult()` in favor of
handling picks and dismissals through `onEngagement()`. A number of providers
use those two methods, so this revision touches a lot of files.

Handling dismissals through `onEngagement()` means `UrlbarInput.pickResult()`
can no longer tell whether a result is successfully dismissed, so it can't
remove the result anymore. (Maybe `onEngagement()` could return some value
indicating it dismissed the result, but I don't want to go down that road.)
Instead, I split `UrlbarController.handleDeleteEntry()` into two methods: a
public one that removes the result and notifies listeners, and a private one
that handles dismissing the selected result internally in
UrlbarController. Providers that have dismissable results should now implement
`onEngagement()` and call `controller.removeResult()`.

I made some other improvements to engagement handling. There's still room for
more but this patch is big enough already.

Other notable changes:

Include the engaged result in engagement notifications so providers have easy
access to it and can respond to clicks and dismissals more easily. That also
lets us stop passing `selIndex` and `provider` to `engagementEvent.record()`
since now it can compute those from the passed-in result.

Add the concept of `isSessionOngoing` to engagement notifications so providers
can tell whether an engagement ended the search session. Right now, providers
like quick suggest that record a bunch of provider-specific legacy telemetry
assume that `onEngagement()` ends the session, but that's no longer true.

Unify result buttons and result menu commands by setting
`element.dataset.command` on buttons (hopefully we can remove buttons soon, at
least the ones that aren't tip buttons)

Make sure we always notify providers on engagement even on dismissals or
when skipping legacy telemetry

Move dismissal of restyled search suggestions and history results from
`UrlbarController.handleDeleteEntry()` to the Places provider

Move dismissal of form history results from
`UrlbarController.handleDeleteEntry()` to the search suggestions provider

In the Places provider, remove the unused `_addSearchEngineMatch()` method. Also
remove the code in the "searchengine" case that creates a non-search-history
result. This code is unreached because the only time the provider creates a
"searchengine" match it also sets `isSearchHistory` to true.

In `UrlbarTestUtils.promiseAutocompleteResultPopup()`, change the default value
of the `fireInputEvent` param from false to true. This is necessary because
without a starting input event, the start event info in `engagementEvent` will
be null, so when `engagementEvent.record()` is called at the end of the
engagement, it will bail, and providers will not be notified of the engagement.
IMO true is a better default value anyway because input events will typically be
fired when the user performs a search.

Differential Revision: https://phabricator.services.mozilla.com/D174941
2023-04-13 06:03:33 +00:00
James Teow
6b5132074e Bug 1826884 - Don't show cached Top Picks if persisted search terms are present - r=adw
Differential Revision: https://phabricator.services.mozilla.com/D174929
2023-04-11 13:01:27 +00:00
Drew Willcoxon
f43087176e Bug 1815686 - Clear the urlbar view before opening it after the window width changes. r=mak
This bug hits [this path](https://searchfox.org/mozilla-central/rev/3ba3d0a57b6419206f82f80cd6c30faf59397664/browser/components/urlbar/UrlbarView.sys.mjs#549-550) in `#autoOpen`, where it re-uses the current rows as
they exist. Overflow and underflow events aren't fired in that case, so the
`overflow` attribute isn't updated. The bug does not happen when the `else`
branch is hit because `onQueryResults()` clears the rows when the view isn't
open, and after that the rows are rebuilt.

This patch makes us hit the `else` path in this case by storing the width of the
input when the view is closed. If the stored width is different from the current
width, then the overflow state may be incorrect. Taking the `else` branch makes
us go through `onQueryResults()` and clear the rows before opening the view.

This fixes this bug and bug 1759857.

Differential Revision: https://phabricator.services.mozilla.com/D173596
2023-03-28 17:36:13 +00:00