Closed Bug 1634569 Opened 5 years ago Closed 5 years ago

window.open() windows created from a mousedown handler immediately lose focus

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- wontfix
firefox75 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- fixed

People

(Reporter: miketaylr, Assigned: emilio)

References

(Regression, )

Details

(Keywords: regression)

Attachments

(2 files)

I'm not sure where this should live, so please move to the right place!

STR:

  1. visit https://miketaylr.com/bzla/vega.html
  2. click on "mousedown" to open a new window/tab
  3. allow the popup, and click again

Expected:
The new tab is focused (it says via mousedown)

Actual:
The new tab opens, then focus jumps back to the original tab

Note: mouseup and click result in expected behavior.

I discovered this while investigating a library which uses mousedown to open new windows, https://github.com/vega/vega-embed/blob/ed326f48996dbb3c3fb8f0a4517f0523afa123be/src/embed.ts#L390-L402

Component: General → DOM: UI Events & Focus Handling
Product: Firefox → Core
Has Regression Range: --- → yes
Has STR: --- → yes
Keywords: regression
Regressed by: 416771

Hrrmmm... Will take a look, over to the queue.

Thanks for finding the regression range Alice, you rock.

Flags: needinfo?(emilio)

So this is basically because of this chunk of code.

I suspect this is to change the focused window on click, but it doesn't really make sense if you're in different tabs or what not... But maybe even then we don't want to do it and we want to rely on the OS? Hmpf.

This seems to come from bug 618907, which seems to be a hack-around code that went away in bug 1595435.

See Also: → 618907, 1595435

This seems to come from bug 618907, which seems to be a hack-around code
that went away in bug 1595435.

If we open a window on mousedown such as it gains focus before this code
runs, we just steal the focus from it, which is undesired.

Also remove the test for bug 799299. It doesn't work anyways if the
browser is remote (this test only runs on non-e10s mode), and this
unifies the behavior with e10s and with content (see attached test-case,
which doesn't change behavior with and without my patch).

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Status: ASSIGNED → NEW
Flags: needinfo?(emilio)
Severity: -- → S3
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6cc9a20bbb57 Remove hackaround for bug that can no longer happen. r=masayuki
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/26aee5b1821f Remove hackaround for bug that can no longer happen. r=masayuki
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78

We have this bug since 69 and no priority set so I guess the fix can ship with 78.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: