1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-28 04:08:47 +02:00

[PM-5189] Fixing issues found within code review behind how we position elements

This commit is contained in:
Cesar Gonzalez 2024-06-24 19:08:02 -05:00
parent 6112d989ce
commit 45c1f78485
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
2 changed files with 10 additions and 6 deletions

View File

@ -173,6 +173,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
)
.subscribe();
// Debounce used to update inline menu position
merge(
this.startUpdateInlineMenuPositionSubject.pipe(debounceTime(150)),
this.cancelUpdateInlineMenuPositionSubject,
@ -793,8 +794,11 @@ export class OverlayBackground implements OverlayBackgroundInterface {
{ isInlineMenuHidden, setTransparentInlineMenu }: ToggleInlineMenuHiddenMessage,
sender: chrome.runtime.MessageSender,
) {
this.cancelInlineMenuFadeIn();
if (sender.tab.id !== this.focusedFieldData?.tabId) {
return;
}
this.cancelInlineMenuFadeIn();
const display = isInlineMenuHidden ? "none" : "block";
let styles: { display: string; opacity?: string } = { display };
@ -1199,6 +1203,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
*/
private async triggerSubFrameFocusInRebuild(sender: chrome.runtime.MessageSender) {
this.rebuildSubFrameOffsetsSubject.next(sender);
this.cancelUpdateInlineMenuPositionSubject.next();
this.repositionInlineMenuSubject.next(sender);
}
@ -1209,7 +1214,6 @@ export class OverlayBackground implements OverlayBackgroundInterface {
* @param sender - The sender of the message
*/
private repositionInlineMenu = async (sender: chrome.runtime.MessageSender) => {
this.cancelUpdateInlineMenuPositionSubject.next();
if (!this.isFieldCurrentlyFocused) {
await this.closeInlineMenuAfterReposition(sender);
return;
@ -1229,7 +1233,6 @@ export class OverlayBackground implements OverlayBackgroundInterface {
this.rebuildSubFrameOffsetsSubject.next(sender);
}
this.cancelUpdateInlineMenuPositionSubject.next();
this.startUpdateInlineMenuPositionSubject.next(sender);
};

View File

@ -313,9 +313,10 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe
*/
private handleFadeInInlineMenuIframe() {
this.clearFadeInTimeout();
this.fadeInTimeout = globalThis.setTimeout(() => {
this.updateElementStyles(this.iframe, { display: "block", opacity: "1" });
}, 10);
this.fadeInTimeout = globalThis.setTimeout(
() => this.updateElementStyles(this.iframe, { display: "block", opacity: "1" }),
10,
);
}
/**