os-js / osjs-dialogs

OS.js Dialogs Module
https://manual.os-js.org/v3/
Other
4 stars 7 forks source link

fix(file): revert ok button behaviour for open dialogs #22

Closed Dorosty closed 1 year ago

Dorosty commented 1 year ago

I made a mistake in #21 and I now realize what the previous code was intended for. In our testing, the open-file dialog now has its OK button disabled by default when selecting directories, even when an initial path is given.

I believe the correct behaviour for the OK button should be:

Dialog type (this.args.type) File Type (this.args.filetype) is File Name Provided (!!this.args.filename) is OK button enabled as a result
open file no no
open file yes yes
open directory no yes (used to be no)***
open directory yes yes***
open file no no
open file yes yes
open directory no no
open directory yes yes

*** only path will get used for the final value since there is no input box for directory name

We have tested this extensively and hope that it works as intended now. Apologies!

Also, pleas note that the expression can be further abbreviated to:

buttons: {
  ok: (this.args.type === 'open' && this.args.filetype === 'directory') || !!this.args.filename
}
andersevenrud commented 1 year ago

No worries :)

Released.