Autofocus in sidePanel? Switching focus between tab and sidepanel with keyboard?

991 views
Skip to first unread message

Kyle Williams

unread,
Jun 6, 2023, 11:58:28 AM6/6/23
to Chromium Extensions
I have an existing popup.html I'm testing for sidePanel. It currently has an input field for the user to enter tags. The input has the autofocus attribute eg:

<input name="tags" autofocus>

Currently, when the popup is invoked via action or shortcut, the input field is autofocused and the user can quickly make an input, invoke the shortcut, and get back to browsing. 

With sidepanel, the autofocus is not happpening when the user invokes via the extension icon or shortcut. 

Further, it seems like the sidepanel itself does not get focus when invoked.

1. is there a way to autofocus an input field in sidebar when the user action / command is made?
2. Is there a way to leave sidebar open, and switch between the sidebar and the active tab without leaving the keyboard? e.g. switching between scrolling a page with keyboard shortcuts and taking notes in a sidebar. 

Jackie Han

unread,
Jun 6, 2023, 1:56:32 PM6/6/23
to Kyle Williams, Chromium Extensions
Good question!

Besides using a mouse, users can use the "Tab" key to switch focus through all UI parts on the browser, but it usually needs to "Tab" or "Shift+Tab" many times.

One drawback of the side panel I've found is the chaotic focus system. I observe the focus change through window.addEventListener("focus"), window.addEventListener("blur") and document.activeElement , when clicking different tabs, clicking side panel, clicking document. But I can't control them in a programming way. When the browser built-in page search function(Ctrl+F) is focused, there are some additional problems.


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/d0da8cb0-49b0-4962-8e9b-98cdd212e16an%40chromium.org.

wOxxOm

unread,
Jun 6, 2023, 3:55:31 PM6/6/23
to Chromium Extensions, Jackie Han, Chromium Extensions, Kyle Williams
There's also F6 and Shift-F6 that treat the entire tab's content area as a single entity i.e. Shift-F6 in the web page will switch to the sidebar without going through the other focusable elements inside the page, F6 in the sidebar will switch to the web page in a similar fashion.

Jackie Han

unread,
Jun 6, 2023, 4:20:46 PM6/6/23
to wOxxOm, Chromium Extensions, Kyle Williams
Reference: https://support.google.com/chrome/answer/157179
F6 is a shortcut on Windows/Linux, not on Mac.
I tried the ⌘ + Option + Up/Down shortcut on Mac. But it focuses on the sidebar switcher, not the sidebar extension document.
Screenshot 2023-06-07 at 04.18.29.png

wOxxOm

unread,
Jun 7, 2023, 12:05:34 AM6/7/23
to Chromium Extensions, Jackie Han, Chromium Extensions, Kyle Williams, wOxxOm
Same behavior in Windows, so indeed Shift-F6 would have to be followed by a few Tab strokes.

akalias

unread,
Nov 27, 2023, 8:49:54 PM11/27/23
to Chromium Extensions, wOxxOm, Jackie Han, Chromium Extensions, Kyle Williams
This is quite disappointing behaviour 
Reply all
Reply to author
Forward
0 new messages