Commit Graph

205 Commits

Author SHA1 Message Date
Daisuke Akatsuka
f751bdcb33 Bug 1941464: Fix double setting the id of item r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D234126
2025-01-14 15:29:50 +00:00
James Teow
1e85ded655 Bug 1901061 - Prevent autofill from immediately triggering on persisted search terms - r=adw,urlbar-reviewers
If the user is modifying their search term, we suspect they don't immediately
want an autofilled url. makeQueryContext always enables autofill if
the allowAutofill is undefined.

Differential Revision: https://phabricator.services.mozilla.com/D233396
2025-01-08 17:43:18 +00:00
Daisuke Akatsuka
216ea392bd Bug 1929515: Assign id to action button when selecting for accessibility r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D233336
2025-01-08 00:09:26 +00:00
Drew Willcoxon
d798414004 Bug 1938517 - Implement new "simplest" weather suggestion UI. r=fluent-reviewers,desktop-theme-reviewers,urlbar-reviewers,emilio,bolsson,daisuke
This makes a number of changes to support a new UI treatment for weather
suggestions in addition to the two existing treatments. Unfortunately we need
all three to experiment with, but hopefully after experimentation is done we can
remove the two existing treatments.

This patch refers to the new treatment as the "simplest" UI. The Figma is at [1]
although it doesn't reflect some details Josh and I have discussed. One of the
existing treatments is already called "simple", and this patch changes its name
to "simpler". The patch refers to the other existing treatment as "full". These
names are only informal because the Nimbus variable and fallback pref are
integers.

Because the new UI treatment is so simple, we can pretty much use the standard
rich suggestion UI for it. The existing treatments are dynamic. I say "pretty
much" because I did need to add a capability to rich suggestions,
`result.richSuggestionIconVariation`, which lets results set an `icon-variation`
attribute on their rows. Weather suggestions use it to choose the appropriate
weather icon in the CSS.

I also modified l10n string caching in a few ways to address a couple of
problems:

* I like how dynamic results can cache their strings lazily by setting
  `cacheable` in their l10n objects. Standard results can only cache their
  strings by adding them to `UrlbarView.#cacheL10nStrings()`. That method is
  getting pretty big, and it also doesn't work well with strings that have
  arguments since it's called to pre-cache strings before they're used, when
  there are no arguments. So I extended `cacheable` support to all l10n objects,
  not only those from dynamic results.
* Josh's spec calls for the temperature in the suggestion title to be bolded.
  There's no good way to do that right now. We have highlights, but they aren't
  useable for l10n strings. The simplest thing -- and what I've done before in
  cases like this -- is to include `<strong>` tags in the l10n string itself.
  That works except for when we have a cache hit with the l10n cache. In that
  case, we set the `textContent`, which of course renders the tag literally. So
  I added a `parseMarkup` option to l10n objects that says the cached string
  should be set as `innerHTML` instead. Actually, for security I parse the
  string into a sanitized document fragment. We could just always do this and
  get rid of `parseMarkup`, but it seems wasteful since most l10n strings don't
  need it.
* While addressing the previous two points, it made sense to move
  `setElementL10n()` from the view to `L10nCache`. That way all these
  cache-related functions are together.

Finally, Josh noticed one of the dark-mode colors in the icon SVG didn't have
enough contrast with the standard dark-mode panel background, so I updated that
to a new color he chose (from `#80808F` to `#9393A8`).

[1] https://www.figma.com/design/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=3548-15992&t=f4YUShEe5RkP2KEg-1

Differential Revision: https://phabricator.services.mozilla.com/D232703
2024-12-27 18:11:23 +00:00
mcheang
f8ea71ac19 Bug 1933003 - Add support to use restricted search keywords in both en-US and the localized language. r=mak,fluent-reviewers,settings-reviewers,urlbar-reviewers,mossop
This patch adds English restrict keyword strings to the enUS-searchFeature.ftl
file. The restrictKeywords providers return an array of keywords for their
l10nRestrictKeywords property. The first is the localized keyword, and the
second is the English keyword. If the user is in the English locale, the
providers return an array with one element: the English keyword.

Differential Revision: https://phabricator.services.mozilla.com/D230009
2024-12-24 22:40:09 +00:00
Daisuke Akatsuka
89e16c6f33 Bug 1929679: Stop using :has() in urlbarView.css r=urlbar-reviewers,adw
Differential Revision: https://phabricator.services.mozilla.com/D228622
2024-11-12 22:19:55 +00:00
Daisuke Akatsuka
c2f5c3753c Bug 1921731: Keep actions' layout until changing the results r=urlbar-reviewers,daleharvey,adw
Differential Revision: https://phabricator.services.mozilla.com/D226107
2024-11-11 05:44:29 +00:00
Daisuke Akatsuka
176b51d0b0 Bug 1921174: Move focus to Dedicated Search button by Tab key from urlbar r=daleharvey,urlbar-reviewers,adw,dao
Differential Revision: https://phabricator.services.mozilla.com/D225176
2024-11-05 22:20:03 +00:00
Florian Quèze
e704e70b3b Bug 1927093 - Migrate scalars to use Glean APIs for urlbar.*, r=chutten,urlbar-reviewers,mak.
Differential Revision: https://phabricator.services.mozilla.com/D226513
2024-11-05 13:22:58 +00:00
Adi
f8402ccb58 Backed out changeset 4df1b9d10c1f (bug 1921174) for causing bc failures @ browser_searchModeSwitcher_basic.js. CLOSED TREE 2024-10-30 08:41:36 +02:00
Daisuke Akatsuka
a081ba9733 Bug 1921174: Move focus to Dedicated Search button by Tab key from urlbar r=daleharvey,urlbar-reviewers,adw
Differential Revision: https://phabricator.services.mozilla.com/D225176
2024-10-30 03:00:32 +00:00
Drew Willcoxon
cbbe362eed Bug 1925734 - Remove UrlbarProviderWeather, the weatherKeywords Nimbus variable, and JS-backend support for weather suggestions. r=daisuke
Depends on D225051

Differential Revision: https://phabricator.services.mozilla.com/D226214
2024-10-22 01:59:13 +00:00
Dale Harvey
37dbf730f3 Bug 1922570 - Show global actions on seperate row from heuristic. r=daisuke,desktop-theme-reviewers,urlbar-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D225051
2024-10-21 19:36:57 +00:00
mcheang
ce3fcffe0e Bug 1921549 - List the keywords in the results panel when a user types @. r=mak,fluent-reviewers,urlbar-reviewers
This patch adds the keywords to the result title for TokenAliasEngine and
RestrictKeyword results. The TokenAliasEngine results may have more than one
keyword if the user has set a custom keyword for that engine. This can help
remind the user what keywords are available as they are typing or if they
have forgotten a keyword, they can type `@` to quickly see the list of keywords
to search with.

The result title looks like this:

For Engines:
 @[keywords] - Search with [Engine]
For Restrict Keywords:
@[keyword] - Search [Restrict]

Differential Revision: https://phabricator.services.mozilla.com/D224017
2024-10-02 18:42:29 +00:00
James Teow
d8061ef3e3 Bug 1903376 - Move searchTerms into UrlbarInput internal state - r=adw,urlbar-reviewers
The purpose of this change is to cache persist state into an object so that in future patches, I can add other persisted search related state to it.

Differential Revision: https://phabricator.services.mozilla.com/D224122
2024-10-01 19:33:54 +00:00
Dale Harvey
522658f297 Bug 1918437 - Disable secondary actions based switch to tab. r=daisuke,desktop-theme-reviewers,urlbar-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D223704
2024-09-30 22:10:48 +00:00
Daisuke Akatsuka
12ba476194 Bug 1913199: Clear userTypedValue when closing the urlbar view if search mode is preview r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D221926
2024-09-13 22:45:17 +00:00
Daisuke Akatsuka
68985d48ee Bug 1913205: Display url upon pressing shift/ctrl for switch to tab suggestion r=desktop-theme-reviewers,daleharvey,dao
Differential Revision: https://phabricator.services.mozilla.com/D221759
2024-09-13 22:09:33 +00:00
Drew Willcoxon
34a4542ebe Bug 1915507 - Replace potential exposures with keyword exposures. r=mak
This replaces the current potential exposures implementation with "keyword
exposures." The current implementation is based on a keyword list defined in
Nimbus. Keyword exposures improve on the following drawbacks to that approach:

* Potential exposures can't be recorded for existing result types without
  duplicating their keywords in the Nimbus list. The ability to record potential
  exposures for existing types is an idea from DS (Dave).
* They're unrelated to `exposure` telemetry, so we don't get an `exposure` event
  for them in the main ping, making it hard to correlate them with engagements
  and abandonments. This is another drawback pointed out by DS (Dave). (By
  design, we don't want to correlate individual keywords with
  engagements/abandonments for privacy reasons, but we do want to know whether a
  potential exposure was triggered during an engagement/abandonment without
  knowing the matching keywords.)
* Storing the keywords in Nimbus means the Nimbus recipe is at least as large as
  the keyword list. It's probably not a great idea to put thousands of keywords
  in the recipe JSON.
* The keyword-matching strategy is simplistic exact matching. It can't do more
  sophisticated strategies used for real results, like how we recently started
  using FTS in Suggest.

Keyword exposures as implemented by this revision improve on all that. Summary:

* Keyword exposures are implemented on top of existing `exposure` telemetry.
  They can be enabled for any result type, and they are always "in addition to"
  `exposure` telemetry.
* They're enabled with a new bool Nimbus variable. When true, they're recorded
  for all results that trigger `exposure` telemetry.
* They work with the new `Exposure` Rust suggestions (bug 1915317, bug 1893086,
  result type "rust_exposure"). In combination, `Exposure` suggestions and
  keyword exposures are the new way to do "potential exposures," i.e., exposure
  telemetry for hypothetical suggestions that includes matching keywords. Like
  every other Rust suggestion type, `Exposure` suggestions take their keywords
  from remote settings and can do sophisticated matching.

Other changes in this revision:

* Keyword exposures are recorded on each instance of a matched result. With the
  current approach, potential exposures are recorded per unique matched keyword.
  That gives us more info. I cleared this idea with Dave.
* Properly detect `terminal` cases by comparing the final query context with the
  context at the time of the exposure. The current detection is wrong because
  it's only based on search strings, which doesn't work because the final search
  string could also have been typed earlier in the session.
* In the feature manifest, change the branch of the related `setPref` variables
  from `default` to `user`. When an experiment is uninstalled, the Nimbus client
  [does *not* restore previous defaults](https://searchfox.org/mozilla-central/rev/446ff34da077a31d5550359480cb327f729c027b/toolkit/components/normandy/lib/PrefUtils.sys.mjs#119) for prefs set on the default branch. That
  breaks some of the tests and also doesn't seem good for users.

Differential Revision: https://phabricator.services.mozilla.com/D220501
2024-09-11 04:47:52 +00:00
Daisuke Akatsuka
51c5b9ed62 Bug 1913204: Apply container color border to secondary action button for tab switch r=desktop-theme-reviewers,urlbar-reviewers,daleharvey,dao
Differential Revision: https://phabricator.services.mozilla.com/D221114
2024-09-09 11:53:09 +00:00
Drew Willcoxon
26cdd4f115 Bug 1914542 - Replace UrlbarResult.exposureResultType and exposureResultHidden with a single simple value. r=mak
This replaces `UrlbarResult.exposureResultType` and `exposureResultHidden` with
a single simple value called `exposureTelemetry`. Please see the bug for the
rationale.

Other changes:

* For convenience, make `UrlbarPrefs.get("exposureResults")` return a `Set` so
  consumers don't have to parse the string value.
* Simplify handling of result properties in `check_results()` (xpcshell tests)
* Add more tasks/checks to test_exposure.js

Depends on D219939

Differential Revision: https://phabricator.services.mozilla.com/D219942
2024-08-27 20:12:55 +00:00
Drew Willcoxon
eeabfdc62a Bug 1913507 - Add capability to show AMP suggestions as top picks based on keyword character counts. r=daisuke,fluent-reviewers,flod
Depends on D219369

Differential Revision: https://phabricator.services.mozilla.com/D219370
2024-08-20 05:57:40 +00:00
mcheang
934e5f7581 Bug 1902537 - Create UrlbarProviderRestrictKeywords to show localized bookmarks, history, and tabs restrict keywords results. r=mak,settings-reviewers,urlbar-reviewers
This patch includes:
- A new UrlbarProviderRestrictKeywords class
- Showing localized Search with Bookmarks, Search with History, Search with Tabs results after the user types @
- Add search restrict keywords to preferences UI Search Shortcuts table
- Hiding search restrict keyword behind browser.urlbar.searchRestrictKeywords.featureGate pref

Differential Revision: https://phabricator.services.mozilla.com/D213697
2024-07-19 23:45:58 +00:00
Drew Willcoxon
96d5364f6b Bug 1908750 - Force dynamic urlbar providers to specify highlighted text in their view updates. r=daisuke,urlbar-reviewers
There are a few ways to solve this problem and I tried to take a straightforward
approach. This patch makes text highlighting less automagical and surprising. It
forces dynamic-result providers to specify highlighted text content as part of
their view updates just like all other non-highlighted text and other
properties. To trigger highlighting, the view update can include a new
`highlights` property.

Except for Fakespot, there currently aren't any providers that take advantage of
the existing automagical highlighting behavior.

Depends on D216370

Differential Revision: https://phabricator.services.mozilla.com/D217020
2024-07-19 00:18:16 +00:00
Daisuke Akatsuka
d445e80774 Bug 1907468: Use icon provided from Rust for each Fakespot suggestion r=adw
Depends on D216493

Differential Revision: https://phabricator.services.mozilla.com/D216370
2024-07-18 20:31:22 +00:00
Dale Harvey
0eccbb1c7f Bug 1903145 - Hide UrlbarView when SearchModeSwitcher opens. r=desktop-theme-reviewers,urlbar-reviewers,daisuke,dao
Differential Revision: https://phabricator.services.mozilla.com/D215281
2024-07-02 20:23:57 +00:00
James Teow
fa3b3d1fea Bug 1905100 - Remove Persisted Search Tip - r=adw,urlbar-reviewers
The onboarding will be handled by OMC who will help with the
messaging for all the scotch bonnet features.

Differential Revision: https://phabricator.services.mozilla.com/D215234
2024-07-01 23:45:47 +00:00
Dale Harvey
7cf2ed740f Bug 1893069 - Add 'browser.urlbar.scotchBonnet.enableOverride' pref. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D210374
2024-05-27 21:56:56 +00:00
Marco Bonardo
d2f59c66ad Bug 1626741 - Roll-up other panels when the Address Bar results panel opens. r=NeilDeakin,jteow
Differential Revision: https://phabricator.services.mozilla.com/D210711
2024-05-27 12:24:54 +00:00
Iulian Moraru
8f36d4dc3d Backed out changeset 4a2ec4353ec1 (bug 1626741) for causing bc failures on browser_fullscreen_context_menu.js. CLOSED TREE 2024-05-25 11:32:43 +03:00
Marco Bonardo
577dcbacdc Bug 1626741 - Roll-up other panels when the Address Bar results panel opens. r=NeilDeakin,jteow
Differential Revision: https://phabricator.services.mozilla.com/D210711
2024-05-23 16:05:26 +00:00
Dale Harvey
5f9ad2e51c Bug 1871206 - Implement secondary actions for the urlbar. r=mak,settings-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D203381
2024-04-23 11:33:33 +00:00
Daisuke Akatsuka
c6bfe80f01 Bug 1889820: Add isManageable attribute to show 'Manage' result menu item in a suggestion r=adw
Differential Revision: https://phabricator.services.mozilla.com/D206862
2024-04-09 07:41:52 +00:00
Drew Willcoxon
a17188bd2b Bug 1886175 - Properly count urlbar hidden exposures whose hypothetical rows can't immediately be shown. r=mak,wstuckey
The problem has to do with hidden exposures whose hypothetical rows can't
immediately be made visible either because they would overflow the filled-up
view or because a misplaced result was seen.

The relevant part of `#updateResults()` is [here](https://searchfox.org/mozilla-central/rev/6a2a2a52d7e544a2fd5678d04991a7e78b694f22/browser/components/urlbar/UrlbarView.sys.mjs#1289-1291). When `canBeVisible` is false,
we effectively forget about that hidden-exposure result, which is not right. For
normal results, we also have that `canBeVisible` logic (a few lines down from
the part I linked), but the difference is that we create a hidden row for them
and then unhide the row when the query finishes and stale rows are removed.
We're missing an analog to that logic for hidden-exposure results, so we're
undercounting them.

Fortunately it's not too hard to fix. I added a new kind of exposure for
`TelemetryEvent` to track called "tentative" exposures. Tentative exposures are
entirely analogous to this case where a row would be added but hidden, and then
unhidden when stale rows are removed.

While I was modifying the test, I rephrased the comments for existing tasks so
hopefully they're easier to understand.

Differential Revision: https://phabricator.services.mozilla.com/D205155
2024-03-21 16:50:47 +00:00
Marco Bonardo
317e4002ac Bug 1884146 - Cross containers switch-tab artifacts remain on other address bar results. r=jteow
The heuristic result is always kept first when receiving new results, that means
any result could be upgraded to be a heuristic result, including the first Top
Site, as in the zero prefix case there's no heuritic.
Thus it's safer to generate new DOM contents when upgrading between heuristic and
non-heuristic.

Also switch-tab results with container info have complex structure and should
generate new DOM contents, unless they are reused by other switch-tab results.

Unfortunately these changes are mostly visual and not easily testable, as it would
be very time consuming.

In general, for the long term, reusing the DOM of results is fragile and causes
nodes, attributes or classes to be ported over to incompatible results. We do it
to avoid flicker, but we must investigate better ways to do it.

Differential Revision: https://phabricator.services.mozilla.com/D204483
2024-03-15 10:18:25 +00:00
Mark Banner
f65518c3c0 Bug 1882577 - Make nsISearchEngine.getIconURL an async function. r=search-reviewers,extension-reviewers,settings-reviewers,robwu,mcheang,mak
Differential Revision: https://phabricator.services.mozilla.com/D203026
2024-03-13 14:51:06 +00:00
Marco Bonardo
36ad633e1e Bug 1883845 - Switch to tab entries in Top Sites (zero prefix) don't support cross container search. r=jteow
Differential Revision: https://phabricator.services.mozilla.com/D203730
2024-03-09 12:05:44 +00:00
Drew Willcoxon
32ab59c29a Bug 1883482 - Transfer row labels to dismissal acknowledgment tips in the urlbar. r=dao,desktop-theme-reviewers
This makes sure the row label transfers to the dismissal acknowledgment tip, if
the dismissed row has a label.

With that fixed, there's one other cosmetic problem where the tip's top border
is right up against the row label. It doesn't look good. I added some additional
space between the label and border.

Differential Revision: https://phabricator.services.mozilla.com/D203559
2024-03-07 20:07:49 +00:00
Dave Townsend
98ed146e46 Bug 1864896: Autofix unused function arguments (browser/components/urlbar). r=mak
Differential Revision: https://phabricator.services.mozilla.com/D202954
2024-03-03 09:09:09 +00:00
Marc Seibert
766fa5166e Bug 1880066 - Switch-to-tab container icons are blurry on Windows/Ubuntu.r=mak
Differential Revision: https://phabricator.services.mozilla.com/D202151
2024-02-20 15:13:44 +00:00
Drew Willcoxon
42558afc2e Bug 1879397 - Show a "Local recommendations" group label for Yelp suggestions and cache remaining group l10n strings. r=daisuke,fluent-reviewers,bolsson
This adds a "Local recommendations" group label for Yelp suggestions.

It also caches all Suggest group labels to avoid pop-in in the urlbar view. The
MDN and Pocket labels weren't being cached.

Differential Revision: https://phabricator.services.mozilla.com/D201157
2024-02-09 03:05:01 +00:00
Marco Bonardo
f0bd48ca5b Bug 1876743 - Enable cross-container Tab Search in Nightly. r=mseibert
Fixes code to properly run tests with the feature enabled.
Fixes code not considering payload.userContextId is set to -1 for private
windows.
Fixes a bug in the _openTabs Map where multiple open tabs to the same url are
not properly counted.

Differential Revision: https://phabricator.services.mozilla.com/D200036
2024-02-07 09:29:32 +00:00
Marc Seibert
ac30c46680 Bug 1876759 - Added voice over text for switch to container tab icon mode.r=mak
Differential Revision: https://phabricator.services.mozilla.com/D199730
2024-01-26 16:45:21 +00:00
Drew Willcoxon
0ec8c8bac6 Bug 1875533 - Properly count hidden urlbar result exposures. r=mak,wstuckey
This fixes the two `#addExposure()` calls in `UrlbarView.#updateResults()` so
that hidden exposures are properly counted. Right now we overcount them because
we record them in cases where the result would not have been shown anyway.

The new test tries to cover all possible `UrlbarView.#updateResults()` paths:

* When the view is full and a new result can't replace any of the old rows, the
  new result is appended and hidden. If the query is then canceled, the new row
  will never be shown
* When the vew isn't full, a new row can be appended and visible immediately
* When a new row replaces an old row, it can be visible immediately

Differential Revision: https://phabricator.services.mozilla.com/D199176
2024-01-25 20:15:55 +00:00
Marc Seibert
0d5499987a Bug 1861530 - Implement the updated UX spec for Switch to tab in containers feature.r=mak,desktop-theme-reviewers,fluent-reviewers,bolsson,dao
Differential Revision: https://phabricator.services.mozilla.com/D192026
2024-01-23 08:54:19 +00:00
Dão Gottwald
fe07007fb3 Bug 1810113 - UrlbarProviderPlaces and UrlbarProviderSearchSuggestions should set isBlockable and blockL10n for history results. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D168993
2024-01-19 21:43:28 +00:00
Mark Banner
0d18781645 Bug 1870644 - Remove nsISearchEngine.iconURI and replace by the new getIconURL function. r=search-reviewers,extension-reviewers,settings-reviewers,mconley,mcheang,robwu
Differential Revision: https://phabricator.services.mozilla.com/D196734
2023-12-20 13:28:24 +00:00
Marco Bonardo
fe296cb095 Bug 1863797 - Frequent failures in browser_schemeless.js due to UrlbarView.selectedElement removed from DOM. r=adw
#selectedElement may end up pointing to disconnected nodes. And so the public
.selectedElement getter.
This is how it was happening: a first call to onQueryResults adds and selects a
heuristic result. Then a second call to onQueryResults brings a new heuristic
result that requires new content (not compatible with the previous one), so the
old heuristic is emptied out, and new DOM is generated.
Because the code in onQueryResults relies on .selectedElement, at the second
invokation it thinks the selection is still valid, and doesn't select the new
heuristic. In reality .selectedElement at that time is pointing to a removed
DOM node.
The patch introduces a #rawSelectedElement and converts #selectedElement
into a getter.

Plus some minor logging improvements, and removing unused #mainContainer property.

Differential Revision: https://phabricator.services.mozilla.com/D195779
2023-12-13 10:05:26 +00:00
Dão Gottwald
9c4a268f65 Bug 1866069 - Announce title and description on the contextual opt-in row when selecting the first element (i.e. the learn more link). r=daleharvey
This is a hack for the experiment and likely not ideal for screen readers, but better than what we have. I'm reaching out to a11y folks to figure out the right long-term solution here. I'll make an effort to get that ready for the experiment too, but would like to get this landed as a backup.

Differential Revision: https://phabricator.services.mozilla.com/D194501
2023-11-28 07:58:01 +00:00
Dão Gottwald
221ee286cf Bug 1866620 - [Firefox Suggest Opt-in Experiment] Bring narrow layout for topPosition=false in line with topPosition=true. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D194691
2023-11-28 07:56:47 +00:00