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

showOpenDialog() unexpected behaviors #12737

Closed
chrilith opened this issue Apr 27, 2018 · 9 comments
Closed

showOpenDialog() unexpected behaviors #12737

chrilith opened this issue Apr 27, 2018 · 9 comments

Comments

@chrilith
Copy link

  • Electron version: 2.0.0-beta.8 and lower
  • Operating system: macOS

Expected behavior

Using filters option, all filters should properly appear, showing defined names and extensions in a dropdown list.

Actual behavior

There is a pending #11959 which may fix this problem.
Problem: when using a wildcard filter, other filters don't appear.

Another problem is that after trying to quit (Cmd+Q) when the dialog is open it will then be impossible to quit the app without the "force quit" option.

How to reproduce

For instance, try:

	filters: [
		{ name: "All Files", extensions: ["*"] },
		{ name: "Interchange File Format", extensions: ["lbm", "iff", "bl1", "bl2", "bl3"] },
		{ name: "Atari Degas Elite", extensions: ["pi1", "pi2", "pi3", "pc1", "pc2", "pc3"] }
	]

Nothing will appear in the dialog. Now remove the first filter and the filters will appear but still showing extensions only as stated in #12571.

Thanks!

@codebytere codebytere self-assigned this Apr 27, 2018
@codebytere
Copy link
Member

I can take a look at this early next week!

@chrilith
Copy link
Author

Great thanks!

@AdrianoFerrari
Copy link

I am experiencing another more serious issue, that's possibly related.

If I have only one non-wildcard filter, clicking on it causes the entire application to crash.
Here's a screen recording of this:
https://www.dropbox.com/s/uc2zq4bj0bfg4g7/dialog-format-bug-2018-04-28_13.06.45.mkv?dl=0

(might not be a factor, but also note that gko is a custom extension of mine, that I didn't register with macOS on install)

@codebytere
Copy link
Member

codebytere commented May 2, 2018

@chrilith this will potentially be solved with #12779; it was merged but not backported so it didn't go out with the latest betas.

@AdrianoFerrari, can you please provide me with the filters/code you used to facilitate the crash in the video above? Thanks 😁

@AdrianoFerrari
Copy link

Sure will do, within next 45min

@AdrianoFerrari
Copy link

AdrianoFerrari commented May 2, 2018

@codebytere Here's the code:
gingko/client@a402d9d

And the resulting build with bug
https://s3.amazonaws.com/gingko-updates/gingko-client-showOpenDialog-bug-mac.zip

@codebytere
Copy link
Member

codebytere commented May 16, 2018

@AdrianoFerrari is this happening on the latest master of Electron? I'm unable to recreate it using the following code:

const { app, BrowserWindow, dialog } = require('electron')
const url = require('url')
const path = require('path')

let win

app.on('ready', () => {
  win = new BrowserWindow({
    width: 800,
    height: 600
  })

  win.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
  }))

  dialog.showOpenDialog(null, {
    title: 'Import JSON File...',
    defaultPath: app.getPath('documents'),
    properties: ['openFile'],
    filters: [
      { name: 'Web Files (*.html)', extensions: ['html'] },
      { name: 'All Files', extensions: ['*'] }
    ]
  })
})

and flipping back and forth between format options

@AdrianoFerrari
Copy link

Yes, seems to be fixed in 2.0.1.
Thanks!

@chrilith
Copy link
Author

Confirmed too! Appart from the dropdown list that doesn't fit its content everything seems to work fine.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants