fix: call SetCanActivate in setFocusable (#21846)
This commit is contained in:
parent
100a85f93a
commit
36fac7bfec
2 changed files with 12 additions and 0 deletions
|
@ -992,6 +992,7 @@ void NativeWindowViews::SetContentProtection(bool enable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetFocusable(bool focusable) {
|
void NativeWindowViews::SetFocusable(bool focusable) {
|
||||||
|
widget()->widget_delegate()->SetCanActivate(focusable);
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
|
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
|
||||||
if (focusable)
|
if (focusable)
|
||||||
|
|
|
@ -687,6 +687,17 @@ describe('BrowserWindow module', () => {
|
||||||
await closeWindow(w2, { assertNotWindows: false })
|
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', () => {
|
describe('sizing', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue