<div dir="ltr">.. all in all of course, I'd prefer a solution that properly fixes this bug and not have to rely on hacks that are prone to break in the future or code that needs to circumvent encapsulation or the module system. So either one is unlikely to be a fix I'm happy with.<div><br></div><div>Thanks for considering submitting a PR to properly fix this issue!</div><div><br></div><div>Kind regards,<br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 12, 2023 at 10:15 PM Pedro Duque Vieira <<a href="mailto:pedro.duquevieira@gmail.com">pedro.duquevieira@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">John,<div><br></div><div>Thank you very much for submitting a work around. Unfortunately, since there were other higher priority bugs and features and we're very close to a release, I wasn't allocated time to work on this much more than sending a message to this mailing list to warn of the existence of this bug.</div><div>Not sure when I can get back to this. I'll submit your suggestion to the dev team and if someone is allocated time to do it, I'll get back here and let you know if it works.<br><br>There's also this suggestion that I forgot to mention (I haven't been able to test it though): <a href="https://stackoverflow.com/questions/65765656/release-mnemonic-when-application-loses-focus" target="_blank">https://stackoverflow.com/questions/65765656/release-mnemonic-when-application-loses-focus</a></div><div><br></div><div>Thanks again, kind regards,</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 12, 2023 at 10:06 PM John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank">john.hendrikx@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>I'm not sure if you are able to test this yourself, but I made a
fix for this problem.</p>
<p>You could potentially test it by copying the class
`javafx.scene.Scene` in your project (without changing the package
-- and if modules will allow it, I don't use them personally) and
then using this piece of code:</p>
<p> private void setWindowFocused(boolean value) {<br>
windowFocused = value;<br>
<br>
Node node = getFocusOwner();<br>
if (node != null) {<br>
node.setFocusQuietly(windowFocused,
focusOwner.focusVisible);<br>
node.notifyFocusListeners();<br>
}<br>
<br>
if (windowFocused && accessible != null) {<br>
accessible.sendNotification(AccessibleAttribute.FOCUS_NODE);<br>
}<br>
<br>
if (!windowFocused) {<br>
getInternalEventDispatcher().getKeyboardShortcutsHandler().setMnemonicsDisplayEnabled(false);<br>
}<br>
}</p>
<p>The last three lines are what I added. A quick test on Windows
here shows that the mnemonics get disabled as soon as the window
loses focus, and when returning, they're not responding as you'd
expect.</p>
<p>I'll submit a PR as well.<br>
</p>
<p>--John<br>
</p>
<div>On 12/02/2023 15:52, Pedro Duque Vieira
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The
behavior on Windows is all over the place for different<br>
applications.? I tested a few I've got running:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Notepad,
Notepad++, Eclipse:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-
Alt-down: Shows mnemonics on menu bar<br>
- Alt-up: Highlights file menu on alt release<br>
- Alt-tab: Shows mnemonics but doesn't highlight menu when it
loses<br>
focus; when returning, mnemonics still highlighted, but
doesn't act on<br>
them as menu not selected</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">->
Looks buggy</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thunderbird
/ Opera / Firefox:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-
Alt-down: nothing<br>
- Alt-up: shows menu bar (it is hidden normally)<br>
- Alt-tab: works as expected, no highlighting</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">->
Looks well behaved</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Explorer
/ Excel / Wordpad:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-
Alt-down: nothing<br>
- Alt-up: shows mnemonics<br>
- Alt-tab: works as expected, no highlighting</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">->
Looks well behaved</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Visual
Studio Code:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-
Alt-down: Shows mnemonics on menu bar<br>
- Alt-up: Highlights file menu on alt release<br>
- Alt-tab: Shows mnemonics, but hides them once it loses
focus; on<br>
return doesn't show mnemonics</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">->
Looks well behaved</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Chrome
/ IntelliJ:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">->
Looks well behaved, doesn't react to alt presses in any way</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">None
of the applications tested reacted on a mnemonic key after<br>
regaining focus however, even though they may have them still<br>
highlighted (which I think is a bug).</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In
my opinion, the behavior of notepad/notepad++/eclipse is
incorrect<br>
(they need to hide the mnemonics on focus lost, like Visual
Studio Code<br>
does, but they don't).</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There
seems to be two correct ways of handling mnemonics in
applications<br>
that use them, either:</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">a)
shows mnemonics immediately on alt-down, but hide them on
focus lost<br>
(if the alt-down becomes an alt-tab, or probably any other alt
combination)</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">b)
only show mnemonics on a naked alt-up</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Ticket
JDK-8090647 mentions a spec that has been updated, but I can't<br>
find it.? It also mentions that the behavior for JavaFX should
be what I<br>
described in a), so I think this is a bug that can simply be
fixed.</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">--John</blockquote>
<div><br>
</div>
<div><br>
</div>
<div>Yap, there's quite different behaviors across apps. If you
test on windows 11 you'll get yet another set of different
behaviors.</div>
<div><br>
</div>
<div>But all in all, if you: alt+tab (without release) and
alt+tab again so your app regains focus, you'll have the
mnemonic still activated, which, as you say, sounds like a bug
no matter the difference in behaviors across apps. <br>
<br>
I agree with your suggestion: "a".<br>
<br>
My client was quite disappointed and started to rant about
javafx. It didn't help that we were hit by a couple other bugs
(perhaps bad luck). The fact that the bug was filed on 2013
(10 years later) and is still happening can be quite
problematic. <br>
Perhaps it would make sense to review all bugs filed, giving
highest priority to the bugs that were submitted longer ago?<br>
<br>
Thanks!</div>
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>Pedro Duque Vieira - <a href="https://www.pixelduke.com" target="_blank">https://www.pixelduke.com</a></div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Pedro Duque Vieira - <a href="https://www.pixelduke.com" target="_blank">https://www.pixelduke.com</a></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Pedro Duque Vieira - <a href="https://www.pixelduke.com" target="_blank">https://www.pixelduke.com</a></div></div></div>