Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: <input type=file> not working in WebContentsView #42018

Closed
3 tasks done
safris opened this issue May 2, 2024 · 2 comments
Closed
3 tasks done

[Bug]: <input type=file> not working in WebContentsView #42018

safris opened this issue May 2, 2024 · 2 comments
Labels

Comments

@safris
Copy link

safris commented May 2, 2024

Preflight Checklist

Electron Version

30.0.2

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

When loading a webpage with a WebContentsView, clicking on an <input type="file"> does not bring up a file selector.

This can be reproduced with the following test that brings up two windows:

  1. Window 1 is a BrowserWindow with the HTML loaded in the BrowserWindow.
    In this window, clicking on the "Choose File" button brings up the file selector.
  2. Window 2 is a BrowserWindow with a WebContentsView added as a child view of its contentView.
    In this window, clicking on the "Choose File" button does not bring up the file selector.

file.html

<html>
<body>
  <input type="file" name="file">
</body>
</html>

index.js

const { app, BrowserWindow, WebContentsView } = require("electron");

app.whenReady().then(() => {
  const win1 = new BrowserWindow({ x: 100, y: 100 });
  win1.loadFile("file.html");

  const win2 = new BrowserWindow({ x: 500, y: 500 });
  const wcv = new WebContentsView();
  win2.contentView.addChildView(wcv);
  wcv.setBounds({x: 0, y: 0, width: 300, height: 300 });
  wcv.webContents.loadFile("file.html");
});

Actual Behavior

When loading a webpage with a WebContentsView, clicking on an <input type="file"> does not bring up a file selector.

Testcase Gist URL

No response

Additional Information

No response

@safris safris added the bug 🪲 label May 2, 2024
@safris
Copy link
Author

safris commented May 2, 2024

Sorry, I just saw this bug is already reported in #42013.

@dsanders11
Copy link
Member

Duplicate of #42013.

@dsanders11 dsanders11 closed this as not planned Won't fix, can't repro, duplicate, stale May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@safris @dsanders11 and others