tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
80.14k stars 2.38k forks source link

[bug] When click on anchor tag external link the tauri window is not losing focus #5524

Open SteelCrow opened 1 year ago

SteelCrow commented 1 year ago

Describe the bug

Continuing the discussion from Discord https://discordapp.com/channels/616186924390023171/1037078929464373249

I caught the bug with anchor tag with link like this <a href="https://kit.svelte.dev" target="_blank" rel="noreferrer">. So, when you click on it, the tauri window is not losing focus like any other app window from OSX.

https://user-images.githubusercontent.com/3636345/199401117-16deddc0-b4c3-4309-bb46-9bbc4ef9e775.mov

Ok, I made some research and have to say, it's something related to OS version because the tauri use open shell command to open link in a browser, in Ventura 13.0 even if you do it from the console, safari is not receiving a focus, but I checked open in Catalina 10.15, and it works as expected.

Reproduction

Use tauri svelte-kit guide from https://tauri.app/v1/guides/getting-started/setup/sveltekit.

Expected behavior

Like in any other OSX app. For an example, TextEdit.app.

https://user-images.githubusercontent.com/3636345/199401195-f9a003c6-66a0-47e0-85f6-ae8a2230a6a0.mov

Platform and versions

Environment › OS: Mac OS 13.0.0 X64 › Node.js: 18.11.0 › npm: 8.19.2 › pnpm: 7.14.1 › yarn: 1.22.19 › rustup: 1.25.1 › rustc: 1.66.0-nightly › cargo: 1.66.0-nightly › Rust toolchain: nightly-x86_64-apple-darwin

Packages › @tauri-apps/cli [NPM]: 1.1.1 › @tauri-apps/api [NPM]: 1.1.0 › tauri [RUST]: 1.1.1, › tauri-build [RUST]: 1.1.1, › tao [RUST]: 0.14.0, › wry [RUST]: 0.21.1,

App › build-type: bundle › CSP: unset › distDir: ../build › devPath: http://localhost:5173/ › framework: Svelte

App directory structure ├─ node_modules ├─ static ├─ src-tauri ├─ .svelte-kit ├─ build └─ src

Stack trace

No response

Additional context

No response

lucasfernog commented 1 year ago

I can't reproduce this (on macOS 13 too). From the open documentation, it should focus the new window unless the -g or --background flag is passed.