Update Feature Callout code to ensure styling is the same in browser chrome as it is when used in content pages such as Firefox View.
Differential Revision: https://phabricator.services.mozilla.com/D159598
Add a new module and feature callout functions to support messages
performing actions when a specified event is dispatched from the
content. This will allow Feature Callout messages to be dismissed when a
button is clicked within the page in which they are rendered. A screen
just needs to provide a `page_event_listeners` property, which is an
array of objects, each containing event listener parameters (event type,
target selector, and optional parameters) and an action specification
like those already used for buttons. The event listener will be added to
all elements matching the selector, so multiple different buttons could
dismiss or advance the message, if necessary. The new screen property
has this form:
```
page_event_listeners: [
{
params: {
type: string,
selectors: string,
options?: {
capture?: boolean,
once?: boolean,
preventDefault?: boolean,
},
},
action: {
type?: string,
data?: object,
dismiss?: boolean,
etc...
},
},
]
```
Differential Revision: https://phabricator.services.mozilla.com/D158899
The "message" property of the pref "browser.firefox-view.feature-tour" seems to have no actual use, and only one value of "FIREFOX_VIEW_FEATURE_TOUR". We can remove it to reduce complexity.
Differential Revision: https://phabricator.services.mozilla.com/D159131
Try to keep feature callouts within the viewport if possible. Make some
changes to fix a bug where callouts could overflow ~10px over the
available space before being repositioned, and also fix a minor typo
issue. Choose the backup position with the greatest available space
instead of based on the position's order in the `positions` object.
Differential Revision: https://phabricator.services.mozilla.com/D157688
I have fixed the underlying XPConnect issue, so these workarounds should
no longer be needed.
There are also two more in browser/base/content/browser-siteProtections.js
that I have not fixed.
Differential Revision: https://phabricator.services.mozilla.com/D158158
When the user moves focus outside of a callout popup while it's open, this patch tracks and saves the most recently focused element until the focus moves back to the popup. Once the user exits the callout series, the focus is (visibly) placed back where the user last left it.
Differential Revision: https://phabricator.services.mozilla.com/D157398
Only show Feature Callout messages when the user preference
`browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features`
is enabled (it's enabled by default). This corresponds to the setting
labeled "Recommend features as you browse" in about:preferences.
Differential Revision: https://phabricator.services.mozilla.com/D156357
Feature Callouts are absolute positioned, but their coordinates are calculated
from those of the parent element given by a selector property on the message.
They were originally adjusted to overlap by 15px, but that was changed to
0.15x - y, where x is the parent width/height and y is the callout's arrow size
(12px). But using a scaling factor may cause unexpected results where parent
elements are unusually large, so this patch switches the overlap amount to 17px.
In the future, we could consider adding a property to the schema so that each
feature tour screen can specify an overlap amount to override the default 17px.
Differential Revision: https://phabricator.services.mozilla.com/D155750
Update About Welcome's invocations of window functions to use optional
chaining to avoid errors when they are undefined. Then, the surfaces
that load the About Welcome bundle will no longer need to define those
references as empty functions.
Differential Revision: https://phabricator.services.mozilla.com/D155011
Update About Welcome's invocations of window functions to use optional
chaining to avoid errors when they are undefined. Then, the surfaces
that load the About Welcome bundle will no longer need to define those
references as empty functions.
Differential Revision: https://phabricator.services.mozilla.com/D155011