mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 20:24:01 +00:00
[PM-5189] Working through further issues on positioning of inline menu
This commit is contained in:
@@ -1296,7 +1296,7 @@ describe("OverlayBackground", () => {
|
||||
[focusedFieldData.frameId, null],
|
||||
]);
|
||||
tabsSendMessageSpy.mockImplementation();
|
||||
jest.spyOn(overlayBackground as any, "repositionInlineMenu");
|
||||
jest.spyOn(overlayBackground as any, "updateInlineMenuPositionAfterRepositionEvent");
|
||||
|
||||
sendMockExtensionMessage(
|
||||
{
|
||||
@@ -1306,9 +1306,11 @@ describe("OverlayBackground", () => {
|
||||
sender,
|
||||
);
|
||||
await flushPromises();
|
||||
jest.advanceTimersByTime(1000);
|
||||
jest.advanceTimersByTime(150);
|
||||
|
||||
expect(overlayBackground["repositionInlineMenu"]).toHaveBeenCalled();
|
||||
expect(
|
||||
overlayBackground["updateInlineMenuPositionAfterRepositionEvent"],
|
||||
).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -679,7 +679,8 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
if (subFrameOffsetsForTab) {
|
||||
subFrameOffsets = subFrameOffsetsForTab.get(this.focusedFieldData.frameId);
|
||||
if (subFrameOffsets === null) {
|
||||
this.repositionInlineMenuSubject.next(sender);
|
||||
this.rebuildSubFrameOffsetsSubject.next(sender);
|
||||
this.startUpdateInlineMenuPositionSubject.next(sender);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1196,7 +1197,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.focusedFieldData.frameId === sender.frameId) {
|
||||
if (this.focusedFieldData?.frameId === sender.frameId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1228,11 +1229,17 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
* @param sender - The sender of the message
|
||||
*/
|
||||
private async triggerOverlayReposition(sender: chrome.runtime.MessageSender) {
|
||||
if (this.checkShouldRepositionInlineMenu(sender)) {
|
||||
this.cancelInlineMenuFadeInAndPositionUpdate();
|
||||
void this.toggleInlineMenuHidden({ isInlineMenuHidden: true }, sender);
|
||||
this.repositionInlineMenuSubject.next(sender);
|
||||
if (!this.checkShouldRepositionInlineMenu(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.focusedFieldData.frameId > 0 && this.subFrameOffsetsForTab[sender.tab.id]) {
|
||||
this.subFrameOffsetsForTab[sender.tab.id].set(this.focusedFieldData.frameId, null);
|
||||
}
|
||||
|
||||
this.cancelInlineMenuFadeInAndPositionUpdate();
|
||||
void this.toggleInlineMenuHidden({ isInlineMenuHidden: true }, sender);
|
||||
this.repositionInlineMenuSubject.next(sender);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1242,8 +1249,8 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
* @param sender - The sender of the message
|
||||
*/
|
||||
private async triggerSubFrameFocusInRebuild(sender: chrome.runtime.MessageSender) {
|
||||
this.rebuildSubFrameOffsetsSubject.next(sender);
|
||||
this.cancelInlineMenuFadeInAndPositionUpdate();
|
||||
this.rebuildSubFrameOffsetsSubject.next(sender);
|
||||
this.repositionInlineMenuSubject.next(sender);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user