# Floating menu stealing focus

**URL:** <https://community.folivora.ai/t/floating-menu-stealing-focus/42864>\
**Category:** Floating Menus / Widgets\
**Tags:** floating-menu\
**Created:** [March 17, 2025, 9:48pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864 "2025-03-17T21:48:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [March 17, 2025, 9:48pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/1 "2025-03-17T21:48:06Z")

</div>

I have a Floating Menu with a Web Item... I use this as sort of a notification, letting me know of some layers pressed on my keyboard. I don't need to interact with it. It seems like whenever I activate it, my cursor will loose focus... I notice this only when I'm on an input field.

It seems like my currently active app doesn't change, but the cursor stops blinking, so it's very inconvenient if I'm in the middle of typing something. Any way to avoid this? I don't know if I'm missing any toggle or option.

---

<div class="post-metadata">

**Author:** ![xidiot](https://community.folivora.ai/user_avatar/community.folivora.ai/xidiot/32/27204_2.png) [@xidiot](https://community.folivora.ai/u/xidiot)\
**Post date:** [March 18, 2025, 7:01am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/2 "2025-03-18T07:01:25Z")

</div>

Make sure that the below configs are disabled:

1.On the Floating Menu itself:

 ![image](https://community.folivora.ai/uploads/default/original/3X/9/3/9388ffbc9981808ac0fc2e4d6f937d3584c3f6a4.png)

1. And this is on "Web item":  
 ![image](https://community.folivora.ai/uploads/default/original/3X/6/5/65d5d1b63c33a745d2b511672756545bf998d573.png)

Just out of curiosity - why are you using floating menus and not "Show HUD overlay" action?

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [March 18, 2025, 7:51am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/3 "2025-03-18T07:51:11Z")

</div>

I think there might currently be an issue where floating menus with webviews always steal the keyboard focus - regardless of settings. I'll check!

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [March 18, 2025, 8:19am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/4 "2025-03-18T08:19:01Z")

</div>

The webviews should not steal focus anymore in 5.273

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [March 18, 2025, 11:42am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/5 "2025-03-18T11:42:29Z")

</div>

> [@xidiot](#):
>
> Just out of curiosity - why are you using floating menus and not "Show HUD overlay" action?

I did try with the Show HUD overlay, but I wanted more control on the font and size. Also, I need to be able to toggle it on/off as needed but the HUD overlay can only be triggered to appear and will fade out automatically (at least in my testing)

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [March 18, 2025, 11:43am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/6 "2025-03-18T11:43:02Z")

</div>

Thank you so much! 5.273 fixed it.

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [May 31, 2025, 4:11am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/7 "2025-05-31T04:11:21Z")

</div>

Somehow, in a recent version the Floating Menus (with a Web Item) are stealing focus once again. I'm on 5.447 and not exactly sure when it started happening. It's not sealing text input focus, it's just the window. You can even notice it on the items on the current window being greyed out (attaching a short sample).

It's disrupting some apps that depend on my focus being on them while opening these floating webviews through BTT.

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [May 31, 2025, 12:39pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/8 "2025-05-31T12:39:28Z")

</div>

I've narrowed the focus issue to version btt5.326-2025042003.zip ... the one before that doesn't have the problem. I hope this helps with the fix. I'm downgrading for now.

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [May 31, 2025, 12:47pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/9 "2025-05-31T12:47:05Z")

</div>

there has been a bugfix in that one which made the focus work if the focus checkboxes were ticked. Maybe you have it set to focus in your show floating menu action?

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [June 1, 2025, 3:37am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/10 "2025-06-01T03:37:13Z")

</div>

Nope. I don't see any focus checkboxes ticked. Here's a quick sample you can probably replicate: [BTT Focus — Screen Studio](https://screen.studio/share/0kkKvsac)

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [June 1, 2025, 7:51am UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/11 "2025-06-01T07:51:41Z")

</div>

could you check whether 5.448 solves this for you?

---

<div class="post-metadata">

**Author:** ![gloogloo](https://community.folivora.ai/user_avatar/community.folivora.ai/gloogloo/32/38134_2.png) [@gloogloo](https://community.folivora.ai/u/gloogloo)\
**Post date:** [June 1, 2025, 12:35pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/12 "2025-06-01T12:35:09Z")

</div>

It does. Thank you so much!

---

<div class="post-metadata">

**Author:** ![zebullon2976](https://community.folivora.ai/letter_avatar_proxy/v4/letter/z/e9c0ed/32.png) [@zebullon2976](https://community.folivora.ai/u/zebullon2976)\
**Post date:** [June 16, 2025, 8:28pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/13 "2025-06-16T20:28:31Z")

</div>

Hi there, old topic, but how can I give keyboard focus back to the active app/window once I clicked on the web view item (because when click on a web view item in floating menu, the current active app/window lost keyboard focus)  
To be clear, my problem is I designed a menu in a webview and show it inside a floating menu. The problem is that when I click on a menu item, the called BTT action does nothing because the app has no more keyboard focus (I try to send a shortcut to the app)

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [June 16, 2025, 8:35pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/14 "2025-06-16T20:35:03Z")

</div>

Mh you could save the currently active window before showing the floating menu:

 ![image](https://community.folivora.ai/uploads/default/original/3X/d/6/d6bbb74f7722fa5c3fa422049fe5c5c0616e91b8.jpeg)

Then in your actions you could restore it before executing whatever other action you want. How are you triggering the actions from your webview?

 ![image](https://community.folivora.ai/uploads/default/original/3X/c/f/cf857392d918fabf1a6de2d9dedc557bcba8b866.jpeg)

---

<div class="post-metadata">

**Author:** ![zebullon2976](https://community.folivora.ai/letter_avatar_proxy/v4/letter/z/e9c0ed/32.png) [@zebullon2976](https://community.folivora.ai/u/zebullon2976)\
**Post date:** [June 16, 2025, 10:34pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/15 "2025-06-16T22:34:05Z")

</div>

That's exactly what I've tried : Saving current active window and app.  
So when I click a web view button, I tried to activate back app/window before running BTT action, but it doesn't work. It is because the active app/window is still active (i.e. the red/orange/green circles are bright) BUT the app/window has no keyboard focus (this is the web view that has the keyboard focus)

I'm triggering BTT action in javascript this way below  
Note that for the moment, the only workaround I found is to hide floating menu, run the BTT action, and show floating menu again. But it is awful the way it makes floating menu blinking ☹

```auto
 execute_assigned_actions_for_trigger({ uuid: __BttReactivateAppTriggerUUID__ }).then((result) ...

```

The triggered actions are defined as keyboard shortcuts, like this one for Apple Mail :

 ![Capture d’écran 2025-06-17 à 00.24.25](https://community.folivora.ai/uploads/default/original/3X/e/e/ee1b147c231def46529dc43b584d0bc553776d22.jpeg)

For information, I'm using a bluetooth numpad as a macro pad. The floating menu help me to remind me what key is assigned to with shortcut, and I also want to be able to click on floating menu button to run BTT action.  
It looks like this :

 ![Capture d’écran 2025-06-17 à 00.33.36](https://community.folivora.ai/uploads/default/original/3X/8/3/83f135f3d4330e8bed6b9f8c4618be036035bb3e.png)

I think the fix should be to have a function to give back an app/window the keyboard focus. I've looked if AppleScript could do that, but no luck, I didn't find a way.

One interesting thing : It seems that "standard items" behave differently, they don't steal keyboard focus of active app/window. This behavior is only concerning "web view items".

---

<div class="post-metadata">

**Author:** ![zebullon2976](https://community.folivora.ai/letter_avatar_proxy/v4/letter/z/e9c0ed/32.png) [@zebullon2976](https://community.folivora.ai/u/zebullon2976)\
**Post date:** [June 16, 2025, 11:04pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/16 "2025-06-16T23:04:48Z")

</div>

In addition, I use this generic trigger to activate back the app/window

 ![Capture d’écran 2025-06-17 à 01.02.50](https://community.folivora.ai/uploads/default/original/3X/d/7/d79048fc80b04a081834cde5477ab8caa3ba4d97.jpeg)

Maybe the action "Activate specific window" should ensure that window has keyboard focus. Don't know if it is a bug or not.

---

<div class="post-metadata">

**Author:** ![zebullon2976](https://community.folivora.ai/letter_avatar_proxy/v4/letter/z/e9c0ed/32.png) [@zebullon2976](https://community.folivora.ai/u/zebullon2976)\
**Post date:** [June 18, 2025, 10:19pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/17 "2025-06-18T22:19:40Z")

</div>

[EDIT and Fully replace my previous post with solution below]  
Finally got it working, hooray ! 👏

Now, I found a way to play with a web view that can trigger BTT actions by clicking web UI buttons/elements 🙂  
If anyone is interested, I can provide exemple files (html, javascript etc.) . I cannot export my preset because it now contains some sensitive data.

**What I've learned**

- Executing "assigned actions for trigger" from web view doesn't work with code like `execute_assigned_actions_for_trigger({uuid: '2F34005D-4537-464D-94E9-A7F42DA39DF1'});` I really don't know why, maybe a bug in BTT or it is because when I click on a web view button the web view steal the keyboard focus (or sort of, but it seems that MacOS is doing something)
- All subsequent web view javascript code **after** a javascript call to an action that hide the floating menu will not be executed (or maybe the 1st one, but it is only because of speed of execution). After reflexion, it is obvious because the web view is closed, so the javascript runtime/execution can not continue. it should be documented somewhere I think
- The web view doesn't really steal the keyboard focus when clicked, but some apps disable (i.e. gray out a part of UI and any BTT trigger doesn't work)
  - For example, with Mail app, when I click inside the web view, the navigation pane is greyed.
    - Before clicking the web view  

    - After clicking the web view  

**What is the project ?**

- I want to turn a simple numpad to a macro pad. It seats on the left of my keyboard
- Because I assign a lot of BTT triggers depending on the macOS app I'm working, I sometimes forget which numpad key does what
- So the project is to display a floating window that represent the numpad with the current app shortcuts assign to each keys (I display Icons)
- As I was working on this project, I found useful to also be able to click with mouse cursor directly on the numpad floating menu button (i.e. the web view) to execute the assigned BTT trigger. This was the most tricky part, because a simple call to javascript BTT function like `execute_assigned_actions_for_trigger` was doing nothing (i.e. correctly executed by BTT, but the macOS app did not respond/react)
- The Resulting BTT floating menu with a "web view" item looks like this (example for Safari app shortcuts)  
 ![Capture d’écran 2025-06-17 à 00.33.36](https://community.folivora.ai/uploads/default/original/3X/8/3/83f135f3d4330e8bed6b9f8c4618be036035bb3e.png)

**What I've done ?**

- For those interested, I give the BTT preset. You should adapt it for your needs
- I discovered that executing the BTT trigger assigned actions from a BTT "reusable trigger" worked. So I needed to setup all "numpad key press" execution in a BTT reusable trigger instead of in with javascript in the web view. The BTT reusable trigger look like this (most relevant parts are in red)  
 ![Capture d’écran 2025-06-22 à 00.36.38](https://community.folivora.ai/uploads/default/original/3X/c/e/ce24e7dd63cec281719749da210f20d3b1a033d1.jpeg)

\*\*\* The key principles are\*\*

- Set a bunch (3) BTT variables in web view with javascript (a trigger to execute this BTT "reusable trigger", the UUID of the BTT trigger containing actions that will be ran, a flag to tell if we need to hide/show floating menu to execute the BTT trigger)
- To trigger this BTT trigger when a BTT variable changed. This variable change is done in the web view with javascript (I set it to 1 to trigger BTT)
- The trigger assigned actions are executed with a "real javascript" BTT action in this trigger. It just use the trigger UUID passed by the web view into a BTT variable to know what BTT trigger UUID assigned actions to run

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [June 26, 2025, 10:17pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/18 "2025-06-26T22:17:32Z")

</div>

In the recent alphas I have added a new option to the "activate previous app" and "activate previous window" actions:

"Only activate previous app if current app is BetterTouchTool". I think you can add this at the beginning of any of your action sequences and workaround potential focus issues with that.

 ![image](https://community.folivora.ai/uploads/default/original/3X/6/f/6fef1041957089d5dca812b4308b2dcc200a3a00.jpeg)

---

<div class="post-metadata">

**Author:** ![zebullon2976](https://community.folivora.ai/letter_avatar_proxy/v4/letter/z/e9c0ed/32.png) [@zebullon2976](https://community.folivora.ai/u/zebullon2976)\
**Post date:** [June 26, 2025, 10:38pm UTC](https://community.folivora.ai/t/floating-menu-stealing-focus/42864/19 "2025-06-26T22:38:28Z")

</div>

Thank, gave it a try with v5.493, but doesn't fix the problem.  
I think we should need something like window.blur() (in javascript) to unfocus the webview. But I can't do this as window.blur() is now deprecated and does nothing.

Anyway, as I don't have this kind of focus problem with floating menu items, I try to do the same thing/design. But a lot of work because drawing a "numpad" with floating items involve manual positioning them (via code). So I have to deal with item position and update their Height, Width, X and Y with update\_menu\_item JS function.  
By the way, do you know that it is impossible to debug real javascript called by BTT Action ? The safari debug view "source" is always empty. I can only see exception and console logs, but the source code is empty. It make very difficult the debugging.
