mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: call SetCanActivate in setFocusable (#21855)
This commit is contained in:
@@ -950,6 +950,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)
|
||||
|
||||
@@ -649,6 +649,16 @@ describe('BrowserWindow module', () => {
|
||||
})
|
||||
})
|
||||
|
||||
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', () => {
|
||||
|
||||
Reference in New Issue
Block a user