[PM-8833] Reworking how the inline menu is opened and positioned to act more uniformly
This commit is contained in:
parent
065299a27e
commit
a2b4c2f40a
|
@ -18,12 +18,12 @@ export type NotificationFormFieldData = {
|
|||
export type AutofillOverlayContentExtensionMessageHandlers = {
|
||||
[key: string]: CallableFunction;
|
||||
addNewVaultItemFromOverlay: ({ message }: AutofillExtensionMessageParam) => void;
|
||||
blurMostRecentlyFocusedField: () => void;
|
||||
blurMostRecentlyFocusedField: () => Promise<void>;
|
||||
focusMostRecentlyFocusedField: () => void;
|
||||
unsetMostRecentlyFocusedField: () => void;
|
||||
checkIsMostRecentlyFocusedFieldWithinViewport: () => Promise<boolean>;
|
||||
bgUnlockPopoutOpened: () => void;
|
||||
bgVaultItemRepromptPopoutOpened: () => void;
|
||||
bgUnlockPopoutOpened: () => Promise<void>;
|
||||
bgVaultItemRepromptPopoutOpened: () => Promise<void>;
|
||||
redirectAutofillInlineMenuFocusOut: ({ message }: AutofillExtensionMessageParam) => void;
|
||||
updateAutofillInlineMenuVisibility: ({ message }: AutofillExtensionMessageParam) => void;
|
||||
getSubFrameOffsets: ({ message }: AutofillExtensionMessageParam) => Promise<SubFrameOffsetData>;
|
||||
|
|
|
@ -200,36 +200,22 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
|||
await this.setupOverlayListenersOnQualifiedField(formFieldElement, autofillFieldData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Focuses the most recently focused field element.
|
||||
*/
|
||||
focusMostRecentlyFocusedField() {
|
||||
this.mostRecentlyFocusedField?.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes focus from the most recently focused field element.
|
||||
*/
|
||||
blurMostRecentlyFocusedField(isClosingInlineMenu: boolean = false) {
|
||||
async blurMostRecentlyFocusedField(isClosingInlineMenu: boolean = false) {
|
||||
this.mostRecentlyFocusedField?.blur();
|
||||
|
||||
if (isClosingInlineMenu) {
|
||||
void this.sendExtensionMessage("closeAutofillInlineMenu");
|
||||
await this.sendExtensionMessage("closeAutofillInlineMenu", { forceCloseInlineMenu: true });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the most recently focused field within the current frame to a `null` value.
|
||||
*/
|
||||
unsetMostRecentlyFocusedField() {
|
||||
this.mostRecentlyFocusedField = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats any found user filled fields for a login cipher and sends a message
|
||||
* to the background script to add a new cipher.
|
||||
*/
|
||||
async addNewVaultItem({ addNewCipherType }: AutofillExtensionMessage) {
|
||||
private async addNewVaultItem({ addNewCipherType }: AutofillExtensionMessage) {
|
||||
const command = "autofillOverlayAddNewVaultItem";
|
||||
const password =
|
||||
this.userFilledFields["newPassword"]?.value || this.userFilledFields["password"]?.value;
|
||||
|
@ -242,7 +228,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
|||
hostname: globalThis.document.location.hostname,
|
||||
};
|
||||
|
||||
void this.sendExtensionMessage(command, { addNewCipherType, login });
|
||||
await this.sendExtensionMessage(command, { addNewCipherType, login });
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -257,7 +243,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
|||
cvv: this.userFilledFields["cardCvv"]?.value || "",
|
||||
};
|
||||
|
||||
void this.sendExtensionMessage(command, { addNewCipherType, card });
|
||||
await this.sendExtensionMessage(command, { addNewCipherType, card });
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -282,10 +268,24 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
|
|||
username: this.userFilledFields["identityUsername"]?.value || "",
|
||||
};
|
||||
|
||||
void this.sendExtensionMessage(command, { addNewCipherType, identity });
|
||||
await this.sendExtensionMessage(command, { addNewCipherType, identity });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Focuses the most recently focused field element.
|
||||
*/
|
||||
private focusMostRecentlyFocusedField() {
|
||||
this.mostRecentlyFocusedField?.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the most recently focused field within the current frame to a `null` value.
|
||||
*/
|
||||
private unsetMostRecentlyFocusedField() {
|
||||
this.mostRecentlyFocusedField = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects the keyboard focus out of the inline menu, selecting the element that is
|
||||
* either previous or next in the tab order. If the direction is current, the most
|
||||
|
|
Loading…
Reference in New Issue