Skip to content

Commit dfd896d

Browse files
Fixed an issue where pgAdmin failed to focus when previously unfocused and then quit. #8760
1 parent ac8f8fb commit dfd896d

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/en_US/release_notes_9_4.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ Bug fixes
4040
| `Issue #8608 <https://github.com/pgadmin-org/pgadmin4/issues/8608>`_ - Handle result grid data changes in View/Edit Data mode by automatically reconnecting to the server if a disconnection occurs.
4141
| `Issue #8668 <https://github.com/pgadmin-org/pgadmin4/issues/8668>`_ - Implement API fetch error display for select dropdown.
4242
| `Issue #8711 <https://github.com/pgadmin-org/pgadmin4/issues/8711>`_ - Fixed an issue where light theme briefly appears when pgAdmin loads or tools open, even when a dark or system UI theme is preferred.
43-
| `Issue #8713 <https://github.com/pgadmin-org/pgadmin4/issues/8713>`_ - Fixed issues related to column range selection using shift + click.
43+
| `Issue #8713 <https://github.com/pgadmin-org/pgadmin4/issues/8713>`_ - Fixed issues related to column range selection using shift + click.
44+
| `Issue #8760 <https://github.com/pgadmin-org/pgadmin4/issues/8760>`_ - Fixed an issue where pgAdmin failed to focus when previously unfocused and then quit.

runtime/src/js/pgadmin.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,16 @@ ipcMain.on('restartApp', ()=>{
406406
app.relaunch();
407407
app.exit(0);
408408
});
409-
ipcMain.on('log', (text) => ()=>{
409+
ipcMain.on('log', (_e, text) => ()=>{
410410
misc.writeServerLog(text);
411411
});
412+
ipcMain.on('focus', (e) => {
413+
const callerWindow = BrowserWindow.fromWebContents(e.sender)
414+
if (callerWindow) {
415+
if (callerWindow.isMinimized()) callerWindow.restore();
416+
callerWindow.focus();
417+
}
418+
});
412419
ipcMain.on('reloadApp', reloadApp);
413420
ipcMain.handle('checkPortAvailable', async (_e, fixedPort)=>{
414421
try {

web/pgadmin/static/js/custom_hooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export function useBeforeUnload({ enabled, isNewTab, beforeClose, closePanel })
246246
const onBeforeUnloadElectron = useCallback((e)=>{
247247
e.preventDefault();
248248
e.returnValue = 'prevent';
249+
window.electronUI?.focus();
249250
beforeClose?.(forceClose);
250251
}, []);
251252

0 commit comments

Comments
 (0)