mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1860585 - Focus close button after opting into shopping. r=ayeddi
Differential Revision: https://phabricator.services.mozilla.com/D195814
This commit is contained in:
parent
92a471167c
commit
1bd472cc71
@ -177,7 +177,7 @@ export class ShoppingSidebarChild extends RemotePageChild {
|
|||||||
// Force re-fetching things if needed by clearing the last product URI:
|
// Force re-fetching things if needed by clearing the last product URI:
|
||||||
this.#productURI = null;
|
this.#productURI = null;
|
||||||
// Then let content know.
|
// Then let content know.
|
||||||
this.updateContent();
|
this.updateContent({ focusCloseButton: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
adsEnabledByUserChanged() {
|
adsEnabledByUserChanged() {
|
||||||
@ -211,6 +211,7 @@ export class ShoppingSidebarChild extends RemotePageChild {
|
|||||||
async updateContent({
|
async updateContent({
|
||||||
haveUpdatedURI = false,
|
haveUpdatedURI = false,
|
||||||
isPolledRequest = false,
|
isPolledRequest = false,
|
||||||
|
focusCloseButton = false,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
// updateContent is an async function, and when we're off making requests or doing
|
// updateContent is an async function, and when we're off making requests or doing
|
||||||
// other things asynchronously, the actor can be destroyed, the user
|
// other things asynchronously, the actor can be destroyed, the user
|
||||||
@ -241,6 +242,7 @@ export class ShoppingSidebarChild extends RemotePageChild {
|
|||||||
showOnboarding: !this.canFetchAndShowData,
|
showOnboarding: !this.canFetchAndShowData,
|
||||||
data: null,
|
data: null,
|
||||||
recommendationData: null,
|
recommendationData: null,
|
||||||
|
focusCloseButton,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.canFetchAndShowData) {
|
if (this.canFetchAndShowData) {
|
||||||
|
@ -55,6 +55,7 @@ export class ShoppingContainer extends MozLitElement {
|
|||||||
shoppingMessageBarEl: "shopping-message-bar",
|
shoppingMessageBarEl: "shopping-message-bar",
|
||||||
recommendedAdEl: "recommended-ad",
|
recommendedAdEl: "recommended-ad",
|
||||||
loadingEl: "#loading-wrapper",
|
loadingEl: "#loading-wrapper",
|
||||||
|
closeButtonEl: "#close-button",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +83,12 @@ export class ShoppingContainer extends MozLitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updated() {
|
||||||
|
if (this.focusCloseButton) {
|
||||||
|
this.closeButtonEl.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async _update({
|
async _update({
|
||||||
data,
|
data,
|
||||||
showOnboarding,
|
showOnboarding,
|
||||||
@ -91,6 +98,7 @@ export class ShoppingContainer extends MozLitElement {
|
|||||||
adsEnabledByUser,
|
adsEnabledByUser,
|
||||||
isAnalysisInProgress,
|
isAnalysisInProgress,
|
||||||
analysisProgress,
|
analysisProgress,
|
||||||
|
focusCloseButton,
|
||||||
}) {
|
}) {
|
||||||
// If we're not opted in or there's no shopping URL in the main browser,
|
// If we're not opted in or there's no shopping URL in the main browser,
|
||||||
// the actor will pass `null`, which means this will clear out any existing
|
// the actor will pass `null`, which means this will clear out any existing
|
||||||
@ -104,6 +112,7 @@ export class ShoppingContainer extends MozLitElement {
|
|||||||
this.adsEnabled = adsEnabled;
|
this.adsEnabled = adsEnabled;
|
||||||
this.adsEnabledByUser = adsEnabledByUser;
|
this.adsEnabledByUser = adsEnabledByUser;
|
||||||
this.analysisProgress = analysisProgress;
|
this.analysisProgress = analysisProgress;
|
||||||
|
this.focusCloseButton = focusCloseButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateRecommendations({ recommendationData }) {
|
_updateRecommendations({ recommendationData }) {
|
||||||
@ -338,7 +347,7 @@ export class ShoppingContainer extends MozLitElement {
|
|||||||
@click=${this.handleClick}
|
@click=${this.handleClick}
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="content" aria-busy=${!this.data}>
|
<div id="content" aria-live="polite" aria-busy=${!this.data}>
|
||||||
<slot name="multi-stage-message-slot"></slot>
|
<slot name="multi-stage-message-slot"></slot>
|
||||||
${sidebarContent} ${!hideFooter ? this.getFooterTemplate() : null}
|
${sidebarContent} ${!hideFooter ? this.getFooterTemplate() : null}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user