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: add missing set_wants_to_be_visible(true) to NativeWindowMac::ShowInactive() #40546

Merged
merged 2 commits into from Nov 30, 2023
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
2 changes: 2 additions & 0 deletions shell/browser/native_window_mac.mm
Expand Up @@ -518,6 +518,8 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
}

void NativeWindowMac::ShowInactive() {
set_wants_to_be_visible(true);

// Reattach the window to the parent to actually show it.
if (parent())
InternalSetParentWindow(parent(), true);
Expand Down
28 changes: 28 additions & 0 deletions spec/api-browser-window-spec.ts
Expand Up @@ -1144,6 +1144,34 @@ describe('BrowserWindow module', () => {
await shown;
expect(w.isMaximized()).to.equal(true);
});

ifit(process.platform === 'darwin')('should attach child window to parent', async () => {
const wShow = once(w, 'show');
w.show();
await wShow;

const c = new BrowserWindow({ show: false, parent: w });
const cShow = once(c, 'show');
c.showInactive();
await cShow;

// verifying by checking that the child tracks the parent's visibility
const minimized = once(w, 'minimize');
w.minimize();
await minimized;

expect(w.isVisible()).to.be.false('parent is visible');
expect(c.isVisible()).to.be.false('child is visible');

const restored = once(w, 'restore');
w.restore();
await restored;

expect(w.isVisible()).to.be.true('parent is visible');
expect(c.isVisible()).to.be.true('child is visible');

closeWindow(c);
});
});

describe('BrowserWindow.focus()', () => {
Expand Down