Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API to switch focus from sidePanel to main document to enable accessibility features #693

Open
SpaceK33z opened this issue Sep 23, 2024 · 4 comments
Labels
supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari

Comments

@SpaceK33z
Copy link

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.

@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels Sep 23, 2024
@hanguokai
Copy link
Member

In contrast, when the side panel is opening, the focus remains on main webpage and does not move to the side panel, which makes some functions impossible. For example, a typical user requirement is to focus on the input box when the side panel opens, so that the user can input something immediately.

So I hope there is a way to solve the problem of bidirectional focus movement.

@xeenon xeenon added supportive: safari Supportive from Safari and removed needs-triage: safari Safari needs to assess this issue for the first time labels Sep 24, 2024
@Rob--W Rob--W added supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox and removed needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time labels Sep 24, 2024
@oliverdunk
Copy link
Member

We discussed this during an in-person triage meeting at TPAC. We are aligned on the following:

  • The behavior @hanguokai mentioned seems like a bug. We should look at ensuring the side panel takes focus from the page when it is first opened regardless of the mechanism used to open it.
  • We are supportive of implementing a tabs.focus() method which would return focus to the web content. This would close the popup if open and move focus away from other parts of the UI such as the address bar.

@xeenon xeenon changed the title Add API to switch focus from sidePanel to main document to enable accessibility features Add API to switch focus from sidePanel to main document to enable accessibility features Sep 24, 2024
@hanguokai
Copy link
Member

We are supportive of implementing a tabs.focus() method which would return focus to the web content. This would close the popup if open and move focus away from other parts of the UI such as the address bar.

A typical case comes to mind. When opening a new tab page(by shortcut or mouse), the focus is on the address bar for user input. Now the new tab page extension would like to call tabs.focus() to move the focus into the NTP for its own searching or shortcut function. Do browsers allow this behavior?

There may be other risks of abuse.

@Rob--W
Copy link
Member

Rob--W commented Sep 28, 2024

I raised that exact question and the answer is that the content area would be focused indeed. The meeting notes for the TPAC 2024 meeting will be published soon, here is the relevant excerpt:

  • [rob] If the address bar was focused and you call this method, what happens?
  • [devlin] It focuses the main content in the tab (document tree in Chrome, webview in Safari) - whatever was the active frame is focused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari
Projects
None yet
Development

No branches or pull requests

5 participants