Repository: tauri
Issue: [bug] Tauri2 on_window_event is fired when end of dom focus element is reached
Labels: type: bug,status: needs triage

### Describe the bug

Within a WebPage you can navigate through all DOM-elements with the "tab"-key. When the last DOM-element is reached, the focus is reassigned to the first DOM-element. This does not work in Tauri2. When the end of all DOM-elements is reached in Tauri2, the Tauri::Window loses its focus.

This might be related (but is definitely not duplicated) by: https://github.com/tauri-apps/tauri/issues/10767
See the second bulletpoint in this comment: 
https://github.com/tauri-apps/tauri/issues/10767#issuecomment-2434339148

 > - window focus is toggling when it shouldn't

https://github.com/user-attachments/assets/18b918a7-d3ef-4d86-a0b4-3b1e7ae11b06





### Reproduction

Create a new sample Project with:

```
cargo install create-tauri-app --locked
cargo create-tauri-app
```

Replace the main function in lib.rs with:

```
pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_shell::init())
        .setup(move |_app: &mut tauri::App| {
            println!("Starting application...");
            Ok(())
        })
        .on_window_event(|_window, event| match event {
            tauri::WindowEvent::Focused(focused) => {
                if !focused {
                    println!("window lost focus");
                } else {
                    println!("window gained focus");
                }
            }
            _ => {}
        })
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
```


Build the Project:

`cargo build`

### Expected behavior

When pressing "Tab" while the focus is on the "Greet" Button, the focus should move to the Tauri-Logo (the first DOM-element).
The Tauri window should not lose its focus.

### Full `tauri info` output

```text
[✔] Environment                                                                                
    - OS: Windows 10.0.19045 x86_64 (X64)                                                      
    ✔ WebView2: 130.0.2849.80                                                                  
    ✔ MSVC:                                                                                    
        - Visual Studio Build Tools 2022                                                       
        - Visual Studio Professional 2022                                                      
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)                                                     
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)                                                     
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)                                                    
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN) 
    - node: 20.15.0                                                                            
    - npm: 10.7.0                                                                              
                                                                                               
[-] Packages                                                                                   
    - tauri 🦀: 2.1.1                                                                           
    - tauri-build 🦀: 2.0.3                                                                     
    - wry 🦀: 0.47.0                                                                            
    - tao 🦀: 0.30.7                                                                            
    - tauri-cli 🦀: 2.0.0-rc.16                                                                 
                                                                                               
[-] Plugins                                                                                    
    - tauri-plugin-shell 🦀: 2.0.2                                                              
                                                                                               
[-] App                                                                                        
    - build-type: bundle                                                                       
    - CSP: unset                                                                               
    - frontendDist: ../src
```


### Stack trace

_No response_

### Additional context

_No response_