max-mapper / max-mapper/menubar

Window ignores first click when opened with mb.window.showInactive() (MacOS)

Open
#260 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6.8k
Forks
363
PR merge metrics
No merged PRs in 30d

Description

Description

Since upgrading from menubar 5.2.3 to 7.1.0, if opening menubar's window using mb.window.showInactive() so to not steal focus, the first click will no longer interact with the browser window.

Steps to Reproduce the Problem
  1. Configure menubar's window so it contains html page with a button.
  2. Use an event (e.g. keyboard shortcut) to trigger mb.window.showInactive() while another OS application has focus.
  3. Try and click on the button with 1 click.
Expected Behaviour

The first click should interact with the UI and click the button, as it does with Menubar 5.2.3

Actual Behaviour

Observe the first click only focuses the window, and does not click the button. A 2nd click is required to action the button.

Specifications
  • Menubar version: 7.1.0
  • Platform: MacOS Mojave 10.14.6
  • Electron version: 7.1.7
Other information

After upgrading from 5.2.3 to 7.1.0, the method used to initialise menubar had to be changed. Posting the code changes here in case it relates to the issue.

v5.2.3 initialisation

const menubar = require('menubar');

const mb = menubar({webPreferences: {nodeIntegration: true}});
mb.setOption('preload-window', true);
mb.setOption('height', 200);
mb.setOption('alwaysOnTop', true);
mb.setOption('icon', app.getAppPath() + '/assets/IconTemplate.png')  // Set app icon
mb.setOption('index', url.format({ // Set the initial page
  pathname: path.join(app.getAppPath(), '/src/notification.html'), 
  protocol: 'file:',
  slashes: true
}))

v7.1.0 initialisation

const {menubar} = require('menubar');

 const mb = menubar({preloadWindow: true,
                     browserWindow:{
                       webPreferences: {nodeIntegration: true},
                       height:200,
                     },
                     alwaysOnTop:true,
                     icon: app.getAppPath() + '/assets/IconTemplate.png',
                     index: url.format({
                       pathname: path.join(app.getAppPath(), '/src/notification.html'),
                       protocol: 'file:',
                       slashes: true
                     })
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the first-click behavior on macOS using mb.window.showInactive(), comparing the Menubar 5.2.3 and 7.1.0 initialization shown in the issue. Start by tracing the showInactive() entry point and window creation options; done when the first click activates the button instead of only focusing the window.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.