Skip to content
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

fix: call SetCanActivate in setFocusable #21855

Merged
merged 1 commit into from Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -651,6 +651,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