Closed Bug 1610821 Opened 4 years ago Closed 4 years ago

Ensure click() works on input elements which are disconnected from a document

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(2 files)

No description provided.
Priority: -- → P2
Attachment #9122345 - Attachment description: Bug 1610821 - Ensure click() works on input elements which are disconnected from a document; → Bug 1610821 - Part 2: Ensure most of event handling works on input elements which are disconnected from a document;
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c8655a12d0b3
Part 1: Remove the unused nsPresContext argument of FireEventForAccessibility(); r=smaug
https://hg.mozilla.org/integration/autoland/rev/96f22cd237f3
Part 2: Ensure most of event handling works on input elements which are disconnected from a document; r=smaug
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75

Ehsan: do you think this might cause site compatibility issues, e.g. unintentional click events?

Flags: needinfo?(ehsan)

(In reply to Kohei Yoshino [:kohei] from comment #7)

Ehsan: do you think this might cause site compatibility issues, e.g. unintentional click events?

I hope it doesn't cause compatibility issues, since this should bring us on par (mostly) with how other browsers behave. But it is certainly possible (even if unlikely) for a site to UA sniff and then run some code only in Firefox which involves triggering an event on a form control which is detached from the document and depend on the event not getting triggered. That's why I added the site-compat keyword.

Flags: needinfo?(ehsan)

Okay, I’ll mention that in my site compat doc.

One thing I just noticed is, Firefox no longer opens a file picker when a detached <input type="file"> is clicked, because the hack has been removed with the patch. It seems this works in Chrome. Is this intentional or should I file a bug for that?

const input = document.createElement('input');
input.type = 'file';
input.click();
Flags: needinfo?(ehsan)

I think that's a non-intentional regression. Do you mind filing a bug for that please? Thanks!

Flags: needinfo?(ehsan)

(In reply to :ehsan akhgari from comment #10)

I think that's a non-intentional regression. Do you mind filing a bug for that please? Thanks!

To be clear I can't reproduce this... This test case seems to work in the latest Nightly for me: https://lateral-composer-7stw8wd42.glitch.me/

Flags: needinfo?(kohei.yoshino)

Sorry for a false alarm. Looks like my issue was unrelated to this change. I was running the snippet in the browser console, and somehow it doesn’t always work even on Firefox 73. The test case Ehsan provided works for me.

And finally posted a site compatibility note for this.

Flags: needinfo?(kohei.yoshino)

<deleted for being a lame question - sorry about that>

Documentation updated:

  • Submitted BCD PR 5856
  • Noted on Firefox 75 for developers
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: