# Foucs behavior issue on sidebar when opening

**URL:** <https://discourse.mozilla.org/t/foucs-behavior-issue-on-sidebar-when-opening/146386>\
**Category:** Development\
**Created:** [October 29, 2025, 7:00am UTC](https://discourse.mozilla.org/t/foucs-behavior-issue-on-sidebar-when-opening/146386 "2025-10-29T07:00:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![2107795244](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/2107795244/32/75272_2.png) [@2107795244](https://discourse.mozilla.org/u/2107795244)\
**Post date:** [October 29, 2025, 7:00am UTC](https://discourse.mozilla.org/t/foucs-behavior-issue-on-sidebar-when-opening/146386/1 "2025-10-29T07:00:52Z")

</div>

as MDN suggests, I build a simple extension improve my experience by sidebar. by the way, it’s really convenient to use vscode extensions and web-ext cli to develop.

the problem is when I toggle the builtin sidebar like history-sidebar, the input is focus automatically.

![focus](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/3X/a/2/a2bcd73e381ccd36b0debc984248b5653e53d956.gif)

however, on my extensions the sidebar can’t be focused.

![nofocus](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/3X/0/9/092455d7d5b2cdf6dd6e113fa8d7d8ec035e8a6f.gif)

and i notice that the setting-sidebar doesn’t swtich focus on it, i’m confused if it’s a normal behavior?

then, i try to manage the focus on myself such as using “autofocus” attr on tag and javascript below:

```auto
window.onload = () => window.focus()
window.addEventListener("focus", () => {
  groupnameInput.focus()
})

```

all of them don’t work. is there any way to handle the focus manually?

---

<div class="post-metadata">

**Author:** ![juraj.masiar](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/juraj.masiar/32/30587_2.png) [@juraj.masiar](https://discourse.mozilla.org/u/juraj.masiar)\
**Post date:** [October 29, 2025, 7:19am UTC](https://discourse.mozilla.org/t/foucs-behavior-issue-on-sidebar-when-opening/146386/3 "2025-10-29T07:19:50Z")

</div>

Sadly, it’s not yet possible, but it’s a planned feature:

> **[1912558 - Ability for extensions to switch focus between sidebar and active...](https://bugzilla.mozilla.org/show_bug.cgi?id=1912558)**
>
> NEW (nobody) in WebExtensions - General. Last updated 2024-11-11.

See also:

> **[1502713 - Set focus to sidebar web extension add-on when activating by...](https://bugzilla.mozilla.org/show_bug.cgi?id=1502713)**
>
> NEW (nobody) in WebExtensions - Frontend. Last updated 2025-03-11.

> <https://github.com/w3c/webextensions/issues/693>
>
> \*\*Description:\*\*
> Interacting with the extension’s side panel (\`chrome.sidePanel…\`) shifts focus away from the main webpage, and there is no way to programmatically return focus to the main document. This limitation makes it impossible to implement some features related to accessibility.
> 
> \*\*Context:\*\*
> Managing focus between the main document and the side panel's document within the same tab is essential for accessibility. 
> With proper focus management, the user can select something from the side panel, and the side panel can simulate certain events that only work when the main document is in focus.
> 
> Currently, extensions can switch focus between tabs, but not within the main document and side panel document.
> 
> \*\*Proposed Solution:\*\*
> Introduce a new API that allows extensions to programmatically shift focus from the side panel back to the main document.

> <https://github.com/w3c/webextensions/issues/833>
>
> High level ideas for discussion:
> 1. query position: left/right
> 2. close()
> 3. foc…us(): tab to and fro side panel
