Closed Bug 1700871 Opened 3 years ago Closed 3 years ago

submitting a form targetting an iframe results in window changing from background to foreground

Categories

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

Firefox 87
x86_64
Windows 10
defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox87 --- wontfix
firefox88 --- verified
firefox89 --- verified

People

(Reporter: gerrit.schulz83, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0

Steps to reproduce:

We have a page ("main page") that contains a form and an iframe. The main page submits said form periodically targetting the iframe.

Actual results:

If the main page is in the background while a different window has the focus the main page changes from background to foreground as soon as the main page submits its form.

Expected results:

The main page should stay in the background. This was the behavior of Firfox before version 86 and still is the behavior in other browsers like Chrome and Edge.

Summary: submitting a form targetting an iframe results in window comin to the foreground → submitting a form targetting an iframe results in window changing from background to foreground
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

Comment on attachment 9211430 [details]
ZIP archive containing html-Files for reproducing the problem.

To reproduce the problem unzip the archive "example_pages.zip" and open the page_background.html file. Then click the button to open a new page in the foreground. After 10 seconds the page in the background submits it's form targetting the iframe and its window changes from background to foreground.

Attachment #9211430 - Attachment description: ZIP archive containing html-Files for reproducing the problem. Start by opening the page_background.html file and click the button to open a new page in the foreground. After 10 seconds the page in the background submits it's form targetting the iframe an → ZIP archive containing html-Files for reproducing the problem.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

Sounds like a regression of 87. We need to know which bug fix caused this.

Severity: -- → S3
Priority: -- → P3

Is this possibly related to all the changes around bug 1694927

Flags: needinfo?(emilio)

27:28.26 INFO: Last good revision: 57c02aedb3c8f5c2126e5b739f11cbf0e30d134e
27:28.26 INFO: First bad revision: d3539dfe1b07c4937e084844999c515475e869bb
27:28.26 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=57c02aedb3c8f5c2126e5b739f11cbf0e30d134e&tochange=d3539dfe1b07c4937e084844999c515475e869bb

Component: DOM: Core & HTML → DOM: UI Events & Focus Handling
Regressed by: 1691214
Has Regression Range: --- → yes

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --
Assignee: nobody → emilio

I put up an slightly more complex test-case here... I'm not sure all the chrome heuristics make sense...

The other navigation that allows focus moves (window.open) already goes
through the popup blocker, so that one is fine.

I think given how weird yet conservative other browsers are, this should
be a good trade-off to avoid false positives.

If you agree with this I'll add a test for the form submission bits.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1c180c9324be
Only allow focus move for links / form submission iff actually handling user input. r=smaug
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

Comment on attachment 9212408 [details]
Bug 1700871 - Only allow focus move for links / form submission iff actually handling user input. r=smaug

Beta/Release Uplift Approval Request

  • User impact if declined: comment 0
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Makes us focus-steal less, behavior is be closer to that of other browsers.
  • String changes made/needed: none
Attachment #9212408 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9212408 [details]
Bug 1700871 - Only allow focus move for links / form submission iff actually handling user input. r=smaug

Approved for 88.0b6.

Attachment #9212408 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/50ebb8f5788d
Tentatively fix macOS permafail in browser_bug1691214.js.
QA Whiteboard: [qa-triaged]

I have reproduced this issue using Firefox 89.0a1 (2012.03.25) on Win 8.1 x64 and Win 10 x64.
I can confirm this issue is fixed, I verified using Firefox 89.0a1 (latest nightly) and 88.0b6 on Win 10 x64, macOS 11.2 and Ubuntu 20.04 x64.

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

Attachment

General

Creator:
Created:
Updated:
Size: