Skip to content

Commit

Permalink
fix: call SetCanActivate in setFocusable (#21855)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 22, 2020
1 parent ef94a79 commit 442174d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions shell/browser/native_window_views.cc
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions spec-main/api-browser-window-spec.ts
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 442174d

Please sign in to comment.