Closed Bug 2050478 Opened 2 months ago Closed 1 month ago

panel-list submenu opens off screen at certain viewport sizes when accessed via keyboard navigation

Categories

(Toolkit :: UI Widgets, defect, P2)

defect

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: hjones, Assigned: tgiles)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(3 files, 1 obsolete file)

I can reproduce this 100% of the time on MacOS when I am running Firefox at full width. STR:

  • make sure Firefox is full width
  • navigate to Firefoxview
  • use the keyboard to open one of the menus
  • use the right arrow key to open the submenu

expected results:

the submenu opens to the left of the main panel so that it's fully visible on screen. This is what happens when you hover over the option/use the cursor to open the submenu.

actual results:

the submenu always opens to the right of the panel meaning the options are always partially obscured

This seems like a related issue - at slightly smaller browser widths trying to open the menu via the keyboard just causes it to auto close and triggers a strange layout shift/flash

Might be related to the popover API changes, I need to confirm one way or the other.

Severity: -- → S2
Flags: needinfo?(tgiles)
Priority: -- → P2
Assignee: nobody → tgiles
Status: NEW → ASSIGNED
Flags: needinfo?(tgiles)

When a submenu was opened with the keyboard at viewport sizes where the
page can scroll horizontally, it would flash open and immediately close.
The submenu's ArrowRight/ArrowLeft handler did not preventDefault, so the
arrow key would scroll the page and then the scroll-hide listener would
dismiss the menu.

We add preventDefault to the submenu open and close key branches, since
this is already done for ArrowDown/ArrowUp/Tab.

Includes regression tests for the arrow-key scroll dismissal in both LTR
and RTL, where the open and close keys are swapped.

A submenu opened by keyboard near the right viewport edge could open
off-screen. setSubmenuAlign() measured the submenu bounds in a single
requestAnimationFrame, but on the keyboard path the submenu content was
not laid out yet, so its width read as 0 and the overflow check chose the
wrong side. This race is timing-dependent and surfaced on macOS but not
Windows, though measuring before layout is wrong regardless.

We defer the measurement with requestAnimationFrame + setTimeout to match
setAlign(), and replace the align-attribute heuristic with an explicit
check of the space available on each side so the submenu opens where it
actually fits. topOffset is also rounded to avoid sub-pixel artifacts,
matching setAlign().

Includes regression tests for the keyboard submenu positioning in both
LTR and RTL.

Attachment #9603146 - Attachment description: Bug 2050478 - Part 2: Fix keyboard-opened panel-list submenu opening off-screen. r?#recomp-reviewers → Bug 2050478 - Fix two panel-list submenu defects on keyboard open: dismissal on page scroll and off-screen opening. r?#recomp-reviewers
Attachment #9603145 - Attachment is obsolete: true
Pushed by tgiles@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/803931c078ca https://hg.mozilla.org/integration/autoland/rev/917e73d8ce07 Fix two panel-list submenu defects on keyboard open: dismissal on page scroll and off-screen opening. r=hjones
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
QA Whiteboard: [qa-triage-done-c156/b155]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: