fix: call SetCanActivate in setFocusable (#21846)

This commit is contained in:
Cheng Zhao 2020-01-22 10:13:48 +09:00 committed by GitHub
parent 100a85f93a
commit 36fac7bfec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -992,6 +992,7 @@ void NativeWindowViews::SetContentProtection(bool enable) {
}
void NativeWindowViews::SetFocusable(bool focusable) {
widget()->widget_delegate()->SetCanActivate(focusable);
#if defined(OS_WIN)
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
if (focusable)

View file

@ -687,6 +687,17 @@ describe('BrowserWindow module', () => {
await closeWindow(w2, { assertNotWindows: false })
})
})
describe('BrowserWindow.setFocusable()', () => {
it('can set unfocusable window to focusable', async () => {
const w2 = new BrowserWindow({ focusable: false })
const w2Focused = emittedOnce(w2, 'focus')
w2.setFocusable(true)
w2.focus()
await w2Focused
await closeWindow(w2, { assertNotWindows: false })
})
})
})
describe('sizing', () => {