Skip to content

Commit

Permalink
Focus ledger access popup twice
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Nov 6, 2024
1 parent 874365b commit 55d8b8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/webextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ type Props = {
export const getPopupUrl = (path: string) =>
browser.runtime.getURL(`${browser.runtime.getManifest()?.action?.default_popup}${path}`)

const openPopup = ({ path, height, width, type }: Props) => {
const openPopup = async ({ path, height, width, type }: Props) => {
const existingPopupWindow = browser.extension.getViews().find(window => window.location.href === path)

if (existingPopupWindow) {
existingPopupWindow.close()
}
browser.windows.create({
const popup = await browser.windows.create({
url: path,
type: type ?? 'popup',
width: width,
height: height,
focused: true,
})
await browser.windows.update(popup.id!, { focused: true }) // Focus again. Helps in rare cases like when screensharing.
}

export const openLedgerAccessPopup = (path: string) => {
Expand Down

0 comments on commit 55d8b8b

Please sign in to comment.