diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 5a5ec1d92f..8a4040f0f3 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -4509,7 +4509,8 @@ void WebContents::OnDevToolsSearchCompleted( void WebContents::SetHtmlApiFullscreen(bool enter_fullscreen) { // Window is already in fullscreen mode, save the state. - if (enter_fullscreen && owner_window()->IsFullscreen()) { + if (enter_fullscreen && (owner_window()->IsFullscreen() || + owner_window()->IsSimpleFullScreen())) { native_fullscreen_ = true; UpdateHtmlApiFullscreen(true); return; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c49b476a75..1cd58f7e3f 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -6681,6 +6681,26 @@ describe('BrowserWindow module', () => { w.setFullScreen(!w.isFullScreen()); }); + ifit(process.platform === 'darwin')('does not exit simpleFullScreen when requestFullscreen is called', async () => { + const w = new BrowserWindow(); + await w.loadFile(path.join(fixtures, 'pages', 'a.html')); + + w.setSimpleFullScreen(true); + expect(w.isSimpleFullScreen()).to.be.true('isSimpleFullScreen'); + + const enterHtmlFS = once(w.webContents, 'enter-html-full-screen'); + await w.webContents.executeJavaScript('document.getElementById("div").requestFullscreen()', true); + await enterHtmlFS; + + expect(w.isSimpleFullScreen()).to.be.true('isSimpleFullScreen after requestFullscreen'); + + const leaveHtmlFS = once(w.webContents, 'leave-html-full-screen'); + await w.webContents.executeJavaScript('document.exitFullscreen()'); + await leaveHtmlFS; + + expect(w.isSimpleFullScreen()).to.be.true('isSimpleFullScreen after exitFullscreen'); + }); + it('should not be changed by setKiosk method', async () => { const w = new BrowserWindow();