1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[PM-5189] Fixing issues found with focusing elements between iframes, as well as fade in of the inline menu in a simultaneous manner for all visual elements

This commit is contained in:
Cesar Gonzalez
2024-05-22 07:32:07 -05:00
parent 2ed62cc6a4
commit 698e68b535
3 changed files with 33 additions and 9 deletions

View File

@@ -343,15 +343,33 @@ export class OverlayBackground implements OverlayBackgroundInterface {
await this.buildSubFrameOffsets(sender.tab, frameId, sender.url);
}
this.updateInlineMenuPositionTimeout = setTimeout(() => {
if (this.isFieldCurrentlyFocused) {
void this.updateInlineMenuPosition({ overlayElement: AutofillOverlayElement.List }, sender);
void this.updateInlineMenuPosition(
{ overlayElement: AutofillOverlayElement.Button },
sender,
);
}
}, 650);
this.updateInlineMenuPositionTimeout = setTimeout(
() => this.updateInlineMenuPositionAfterSubFrameRebuild(sender),
650,
);
}
private async updateInlineMenuPositionAfterSubFrameRebuild(sender: chrome.runtime.MessageSender) {
if (!this.isFieldCurrentlyFocused) {
return;
}
void this.updateInlineMenuPosition({ overlayElement: AutofillOverlayElement.Button }, sender);
const mostRecentlyFocusedFieldHasValue = await BrowserApi.tabSendMessage(
sender.tab,
{ command: "checkMostRecentlyFocusedFieldHasValue" },
{ frameId: this.focusedFieldData.frameId },
);
if (
mostRecentlyFocusedFieldHasValue &&
(this.checkIsOverlayLoginCiphersPopulated(sender) ||
this.userAuthStatus !== AuthenticationStatus.Unlocked)
) {
return;
}
void this.updateInlineMenuPosition({ overlayElement: AutofillOverlayElement.List }, sender);
}
/**

View File

@@ -23,6 +23,7 @@ export type AutofillOverlayContentExtensionMessageHandlers = {
updateAutofillInlineMenuVisibility: ({ message }: AutofillExtensionMessageParam) => void;
getSubFrameOffsets: ({ message }: AutofillExtensionMessageParam) => Promise<SubFrameOffsetData>;
getSubFrameOffsetsFromWindowMessage: ({ message }: AutofillExtensionMessageParam) => void;
checkMostRecentlyFocusedFieldHasValue: () => boolean;
};
export interface AutofillOverlayContentService {

View File

@@ -54,6 +54,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
getSubFrameOffsets: ({ message }) => this.getSubFrameOffsets(message),
getSubFrameOffsetsFromWindowMessage: ({ message }) =>
this.getSubFrameOffsetsFromWindowMessage(message),
checkMostRecentlyFocusedFieldHasValue: () => this.mostRecentlyFocusedFieldHasValue(),
};
/**
@@ -859,6 +860,10 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
);
}
private mostRecentlyFocusedFieldHasValue() {
return Boolean((this.mostRecentlyFocusedField as FillableFormFieldElement)?.value);
}
/**
* Sets up global event listeners and the mutation
* observer to facilitate required changes to the