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:
@@ -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,
|
||||
this.updateInlineMenuPositionTimeout = setTimeout(
|
||||
() => this.updateInlineMenuPositionAfterSubFrameRebuild(sender),
|
||||
650,
|
||||
);
|
||||
}
|
||||
}, 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user