Skip to content

Commit 784c809

Browse files
Merge pull request #29 from oracle/dialog-app-menu
Fix problem with app menu appearing on modal dialogs in Linux
2 parents 4295659 + 3f4a345 commit 784c809

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

electron/app/js/prompt/about.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<div id="appName" class="textLine main">...</div>
1818
<div id="version" class="textLine">...</div>
1919
<div id="copyright" class="textLine">...</div>
20-
<div id="buttons">
21-
<button type="submit" id="ok">...</button>
22-
</div>
2320
</form>
2421
</div>
2522
<script src="about.js"></script>

electron/app/js/prompt/about.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@ function promptRegister() {
3232
return promptError(error);
3333
}
3434

35-
const okButton = document.querySelector('#ok');
36-
37-
okButton.addEventListener('keyup', event => {
35+
document.addEventListener('keyup', event => {
3836
if (event.key === 'Escape') {
3937
promptCancel();
4038
}
4139
});
4240

4341
document.querySelector('#form').addEventListener('submit', promptSubmit);
4442

45-
okButton.focus();
46-
4743
window.api.i18n.ready.then(() => {
4844
const versionText = window.api.i18n.t('dialog-about-version', {
4945
version: promptOptions.applicationVersion,
@@ -55,8 +51,6 @@ function promptRegister() {
5551
document.querySelector('#version').textContent = versionText;
5652
document.querySelector('#copyright').textContent = promptOptions.copyright;
5753

58-
okButton.textContent = window.api.i18n.t('dialog-button-ok');
59-
6054
const height = document.querySelector('body').offsetHeight;
6155
window.api.ipc.sendSync('prompt-size:' + promptId, height);
6256
});

electron/app/js/promptUtils.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ async function getCredentialPassphrase(parentWindow) {
3232
alwaysOnTop: false,
3333
useContentSize: true,
3434
modal: Boolean(parentWindow),
35+
autoHideMenuBar: true,
3536
menuBarVisible: false,
3637
webPreferences: {
3738
nodeIntegration: false,
@@ -42,7 +43,9 @@ async function getCredentialPassphrase(parentWindow) {
4243
},
4344
});
4445

46+
// hide app menu for various platforms
4547
promptWindow.setMenu(null);
48+
promptWindow.removeMenu();
4649
promptWindow.setMenuBarVisibility(false);
4750

4851
const getOptionsListener = event => {
@@ -110,7 +113,7 @@ async function showAboutDialog(wktApp, parentWindow) {
110113
const preloadFile = path.join(__dirname, 'prompt', 'preload.js');
111114

112115
const WIDTH = 400;
113-
const HEIGHT = 234; // renderer will send IPC to adjust this
116+
const HEIGHT = 186; // renderer will send IPC to adjust this
114117
const MIN_HEIGHT = 120; // needs to be smaller than content height
115118

116119
return new Promise((resolve, reject) => {
@@ -128,7 +131,8 @@ async function showAboutDialog(wktApp, parentWindow) {
128131
skipTaskbar: true,
129132
alwaysOnTop: false,
130133
useContentSize: true,
131-
modal: Boolean(parentWindow),
134+
modal: Boolean(parentWindow), // false causes problems with app menu appearing
135+
autoHideMenuBar: true,
132136
menuBarVisible: false,
133137
webPreferences: {
134138
nodeIntegration: false,
@@ -139,7 +143,9 @@ async function showAboutDialog(wktApp, parentWindow) {
139143
},
140144
});
141145

146+
// hide app menu for various platforms
142147
promptWindow.setMenu(null);
148+
promptWindow.removeMenu();
143149
promptWindow.setMenuBarVisibility(false);
144150

145151
const getOptionsListener = event => {

0 commit comments

Comments
 (0)