If an AudioDeviceSelectorComponent is displayed to the user inside a JUCE modal window, such as the kind created via juce::DialogWindow::LaunchOptions::launchAsync(), and the user clicks the “Bluetooth MIDI” button, the macos Bluetooth window that opens will be behind the DialogWindow, and even clicking it won’t bring it to the top. Also, if the DialogWindow is large enough, the user won’t even have any indication that the Bluetooth menu was opened, since it will be completely obscured. Furthermore, if the users clicks the “Bluetooth MIDI” button again, it will open another Bluetooth menu, as many times as they click.
It seems like showing the AudioDeviceSelectorComponent in a modal DialogWindow is a pretty normal thing to do (e.g. an options menu) so this seems like a significant problem.
I think it would be reasonable to make the Bluetooth window modal?
This brings the new window above the DialogWindow and makes it stay on top.
(However NB that it does NOT make it modal, so the user can move the Bluetooth window out of the way and click the “Bluetooth MIDI” button several more times to open several Bluetooth windows, which seems pretty silly.)
Can you share more about how to reproduce this issue? On MacOS 15.4 the Bluetooth window always comes to front in my case, and it’s also possible to switch back and forth between the modal window and the Bluetooth window.
I think there’s a small detail missing. I’ll share my repro attempt, hopefully you can see what’s different compared to your case.
After some digging, I found the difference between my app and your minimal test case: my app creates a desktop window that is set to alwaysOnTop, but is not visible most of the time. I added this to your test case as desktopComponent.
Obviously I understand why desktopComponent itself, were it to be visible, would appear on top of the bluetooth MIDI window. But somehow its existence, even while not visible, causes the bluetooth MIDI window to appear behind the dialog window.
My (perhaps misguided?) expectations here are that:
The desktopComponent’s alwaysOnTop-ness would not have any effect on other windows when desktopComponent is not visible
The desktopComponent wouldn’t ever affect the ordering of other windows relative to one another, regardless of desktopComponent’s visibility.