Closed Bug 1899741 Opened 1 year ago Closed 11 months ago

Allow focus to move into and out of feature callouts

Categories

(Firefox :: Messaging System, defect, P1)

Firefox 126
Desktop
All
defect
Points:
5

Tracking

()

RESOLVED WONTFIX
Iteration:
141.1 - May 26 - Jun 6

People

(Reporter: IoanaAlexandra.Berar, Assigned: aminomancer)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

Attached video bugESC.mp4

[Affected versions]:

  • Firefox build version >=123

[Affected Platforms]:

  • Windows 10 x64
  • macOS Ventura 13.6.2
  • Ubuntu 22.04 x64

[Prerequisites]:

[Steps to reproduce]:

  1. Open the browser from the prerequisites
  2. Open a new tab.
  3. Open a new tab.
  4. Close the message using the “ESC” key.

[Expected result]:

  • The message is closed using the “ESC” key when there is more than one opened tab

[Actual result]:

  • The message cannot be closed using the “ESC” key when there is more than one opened tab

[Notes]:

  • A video of this issue is attached.
  • We noticed that this bug is related to the fact that the “Discovery Search” message cannot be focused when there is more than one opened tab.
  • This issue is occurring for early day users and existing users, too, and for all the branches.
Assignee: nobody → jprickett
Status: NEW → ASSIGNED
Flags: needinfo?(shughes)
Flags: needinfo?(jprickett)
Duplicate of this bug: 1899740

I guess the real issue here is that you can't tab into the callout. It's expected that the callout must be focused for the Escape key to close it. But it's not desired for it to be impossible to tab into or out of the callout, since that makes it impossible for keyboard-only users to close the callout if it somehow loses focus. (I suppose it's unlikely for it to lose focus for a keyboard-only user, though, since focus also gets trapped within the callout panel. Still, not optimal for accessibility.)

This might have always been the case since we adopted panels, or the issue might be that I made the callout panel unfocusable (removing tabIndex) in bug 1898346, because we didn't like having a non-interactive element focusable, especially the focus ring. The content inside the panel should be focusable, but I guess that can't happen for some reason. Focus also gets trapped in the callout.

It's like the panel has its own separate focus context, but I'm not sure where that is implemented. I know most panels in the browser use TreeWalkers to handle focus, but this particular panel does not use panelUI or PanelMultiView. It's just a <panel> created over here.

It can be tested like this:

  1. Set browser.newtabpage.activity-stream.asrouter.devtoolsEnabled to true
  2. Go to about:asrouter
  3. Search for TEST_FEATURE_TOUR with the findbar, click the "Show" button for its row

Gijs or Emilio, if you have some time to spare, could you help us understand how focus behavior works for panels? How does focus get "stuck" inside the panel, and what prevents focus from landing inside the panel when tabbing from outside it? Thank you.

Flags: needinfo?(shughes)
Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(emilio)

(In reply to Shane Hughes [:aminomancer] from comment #2)

Gijs or Emilio, if you have some time to spare, could you help us understand how focus behavior works for panels? How does focus get "stuck" inside the panel, and what prevents focus from landing inside the panel when tabbing from outside it? Thank you.

This is long-standing / since forever, see this comment: https://searchfox.org/mozilla-central/rev/b476ffaef761ff85c012e2d93050cf444ff7be34/dom/base/nsFocusManager.cpp#4246-4255

Now whether we should avoid it... I think it might be worth trying, or worth adding a CSS opt-in / opt out for that? Maybe we should only trap focus for autohide panels?

Sean has been looking at making this code use the DOM tree, and maybe has thoughts?

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #3)

This is long-standing / since forever, see this comment: https://searchfox.org/mozilla-central/rev/b476ffaef761ff85c012e2d93050cf444ff7be34/dom/base/nsFocusManager.cpp#4246-4255

Great, thank you!

Now whether we should avoid it... I think it might be worth trying, or worth adding a CSS opt-in / opt out for that? Maybe we should only trap focus for autohide panels?

That sounds reasonable. The ctrlTab code might need to be adjusted, but other than that I can't think of are any other non-autohide panels besides ours.

ni?sefeng for feedback on Emilio's suggestion, thanks!

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(sefeng)

Sorry, I don't have much thoughts on this. I think what Emilio suggested make sense. I guess I'd prefer Maybe we should only trap focus for autohide panels? for better consistency.

Flags: needinfo?(sefeng)

I found that update notifications (AppMenuNotifications) also disable autohide. So that may be kind of an a11y problem, since you can't focus into those update notifications using just a keyboard.

Iteration: --- → 129.1 - Jun 10 - Jun 21
Points: --- → 5
Flags: needinfo?(jprickett) → needinfo?(shughes)
Priority: -- → P1

I've noticed that some of this logic which prevents tabbing into/out of a popup frame also applies to popover frames. But I don't think popovers have the same autohide behavior. At least, I haven't been able to find any documentation of autohide behavior for popovers. And this is actually directly relevant to this bug, because we plan to start using popover for feature callouts in HTML content.

So, what should we do about popovers? Perhaps instead of branching on noautohide, we should add a new attribute (trapfocus?) that directly controls this behavior. However, it seems like there's a big difference between changing behavior for our proprietary XUL elements and changing behavior for an HTML element that implements a web standard. Would I have permission to add a nonstandard feature to popover? Or should I just leave the behavior as-is for popover elements?

Flags: needinfo?(emilio)

I haven't been able to find any documentation of autohide behavior for popovers.

https://html.spec.whatwg.org/#popover-light-dismiss?

So, what should we do about popovers?

If the focus behavior of popovers is not sufficient or not sufficiently controllable, then we should file a spec issue. We could propose and prototype a solution for that if / as needed.

Flags: needinfo?(emilio)
Iteration: 129.1 - Jun 10 - Jun 21 → 129.2 - Jun 24 - Jul 5
Attachment #9408037 - Attachment description: WIP: Bug 1899741 - Allow focus to move into and out of noautohide popups. r=emilio → Bug 1899741 - Allow focus to move into and out of noautohide popups. r=emilio
Assignee: jprickett → nobody
Status: ASSIGNED → NEW
Iteration: 129.2 - Jun 24 - Jul 5 → 130.1 - Jul 8 - Jul 19
Assignee: nobody → shughes
Flags: needinfo?(shughes)
Iteration: 130.1 - Jul 8 - Jul 19 → 130.2 - Jul 22 - Aug 2

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:aminomancer, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(shughes)
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Iteration: 130.2 - Jul 22 - Aug 2 → 131.1 - Aug 5 - Aug 16
Iteration: 131.1 - Aug 5 - Aug 16 → 131.2 - Aug 19 - Aug 30
Iteration: 131.2 - Aug 19 - Aug 30 → 132.1 - Sep 2 - Sep 13
Iteration: 132.1 - Sep 2 - Sep 13 → 132.2 - Sep 16 - Sep 27
Iteration: 132.2 - Sep 16 - Sep 27 → 133.1 - Sep 30 - Oct 11
Iteration: 133.1 - Sep 30 - Oct 11 → 133.2 - Oct 14 - Oct 25
Iteration: 133.2 - Oct 14 - Oct 25 → 134.1 - Oct 28 - Nov 8
Iteration: 134.1 - Oct 28 - Nov 8 → 134.2 - Nov 11 - Nov 22

We hit an issue while landing an addons callout in m-c; where the existing focus behaviour was called out for pulling focus from the URL bar when opening a new tab.

Just noting here that the original focus behaviour was added partially as an a11y feature for VoiceOver on Mac. Putting focus in the callout allows the screen reader to announce the callout; though this workaround is only necessary for MacOs; Windows users using either NVDA or Narrator should hear the callout announced due to the role=alertdialog property.

Iteration: 134.2 - Nov 11 - Nov 22 → 135.1 - Nov 25 - Dec 6
Iteration: 135.1 - Nov 25 - Dec 6 → 135.2 - Dec 9 - Dec 20
Iteration: 135.2 - Dec 9 - Dec 20 → 135.3 - Dec 23 - Jan 3
Iteration: 135.3 - Dec 23 - Jan 3 → 136.1 - Jan 6 - Jan 17
Iteration: 136.1 - Jan 6 - Jan 17 → 136.2 - Jan 20 - Jan 31
Iteration: 136.2 - Jan 20 - Jan 31 → 137.1 - Feb 3 - Feb 14
Iteration: 137.1 - Feb 3 - Feb 14 → 137.2 - Feb 17 - Feb 28
Flags: needinfo?(shughes)
Summary: [Experiment] The message cannot be closed using the “ESC” key when there is more than one opened tab → Allow focus to move into and out of feature callouts
Iteration: 137.2 - Feb 17 - Feb 28 → 138.1 - Mar 3 - Mar 14
Iteration: 138.1 - Mar 3 - Mar 14 → 138.2 - Mar 17 - Mar 28
Iteration: 138.2 - Mar 17 - Mar 28 → 139.1 - Mar 31 - Apr 11
Iteration: 139.1 - Mar 31 - Apr 11 → 139.2 - Apr 14 - Apr 25
Iteration: 139.2 - Apr 14 - Apr 25 → 140.1 - Apr 28 - May 9
Iteration: 140.1 - Apr 28 - May 9 → 140.2 - May 12 - May 23
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → WONTFIX
Iteration: 140.2 - May 12 - May 23 → 141.1 - May 26 - Jun 6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: