On Fri, 6 Nov 2026 18:45:08 GMT, yogi1967 <[email protected]> wrote: > **Symptom:** > On macOS, after selecting text in a Swing `JTextField` with the mouse from > right to left (including the first character, and releasing just past the > field's left edge), typing does not work normally. Each typed character > replaces the previous one, so the field only ever shows one character. > Clicking in the field clears the state. > > **Cause:** > On macOS, `nsToJavaModifiers` reads the current button state. If a > `MOUSE_DRAGGED` event is converted after the button is released, it has no > button modifier, so the mouse grab is dropped and `MOUSE_RELEASED` is > delivered to the wrong component. The text field never receives the > `MOUSE_RELEASED` event, so its `Autoscroller` continues re-applying the drag > selection which causes the condition where subsequently typed text appears > trapped in character one of the field in overtype mode. > > This issue has already been addressed by JetBrains in their JDK versions: > - JBR issue: [JBR-5762](https://youtrack.jetbrains.com/issue/JBR-5762) > - JBR fix commit: > [c3cf8bddea970e9ff413b0e7ad613ed003336b21](https://github.com/JetBrains/JetBrainsRuntime/commit/c3cf8bddea970e9ff413b0e7ad613ed003336b21) > - The current code file (refer Jbr5762Fix): > [CPlatformResponder.java](https://github.com/JetBrains/JetBrainsRuntime/blob/jbr25/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java) > > This PR/commit applies the same fix/logic as the JBR version (without JBR's > on/off system property). > > Testing: > - manual tests are problematic as it depends on system and EDT load, and race > conditions. I was able to reproduce with manual tests, but the bug reviewer > was not. > - automated `java.awt.Robot` tests don't trigger the condition > - however, I also tested the condition in our live java application where > it's easier to reproduce, the error occurred after 8 attempts > - applied this fix as patch to the same working java application and proved > that the issue did not occur (100 attempts), and that the fix properly caught > the trigger. > - requires `noreg-hard` label added to bug report by sponsor > - if required, I can upload the test file that intermittently works for me > > Further evidence: > - when running our live java app in debug mode within IntelliJ IDEA using JBR > JDK (and default parameters) the issue does not appear. > - When running with the JBR JDK but with their > `-Dawt.mac.enforceMouseModifiersForMouseDragged=false` setting to disable the > JBR fix, the issue is reproduced. > - I would offer that the JBR fix is already working and proven ...
This PR needs to be withdrawn. The submitter needs to ask JB to submit a fix. > This issue has already been addressed by JetBrains in their JDK versions: >JBR issue: [JBR-5762](https://youtrack.jetbrains.com/issue/JBR-5762) >JBR fix commit: [c3cf8bddea970e9ff413b0e7ad613ed003336b21]> ... These comments concern me greatly. You CANNOT just go to the JetBrains repo, grab their commit and contribute it to OpenJDK because you do not own that change. It directly contradicts the terms of the Contributor Agreement that you signed. Only JetBrains can make that contribution. ------------- Changes requested by prr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33778#pullrequestreview-5833322967 PR Comment: https://git.openjdk.org/jdk/pull/33778#issuecomment-6752366798
