-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Add sheet-begin and sheet-end events to macOS BrowserWindow #9108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few minor comments, thanks for adding this 👍
spec/api-browser-window-spec.js
Outdated
@@ -1191,6 +1191,41 @@ describe('BrowserWindow module', function () { | |||
}) | |||
}) | |||
|
|||
describe('begin-sheet event', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't take a done
callback, the it
function should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice the mistake, thanks!
spec/api-browser-window-spec.js
Outdated
}) | ||
}) | ||
|
||
describe('end-sheet event', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't take a done
callback, the it
function should
spec/api-browser-window-spec.js
Outdated
return | ||
} | ||
it('emits when window opens a sheet', function () { | ||
let sheet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a variable declared at the root describe
level and this window should be cleaned up in an afterEach
to make sure it does not stick around.
afterEach(function () {
return closeWindow(sheet).then(function () { sheet = null })
})
docs/api/browser-window.md
Outdated
@@ -498,6 +498,14 @@ Returns: | |||
|
|||
Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`, `left`. | |||
|
|||
#### Event: 'begin-sheet' _macOS_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about calling these sheet-begin
and sheet-end
instead?
Then they would follow the naming pattern of the scroll-touch-*
events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I was not able to decide because there is also the pattern of *-full-screen
events.
3654406
to
7518404
Compare
Updated. Now |
Thanks for this @yuya-oc 👍 🚀 |
These would be helpful when a dialog is opened without using BrowserWindow's
modal
option ordialog
module.For example, when a dialog is opened by
<input type="file">
of a webview, the webview loses focus after the dialog is closed. This new event can tell that the dialog has been closed in order to get focus again.