JDK-8284113 : No MOUSE_PRESSED or MOUSE_RELEASED on TextArea
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx11,8,jfx17
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2022-03-31
  • Updated: 2024-06-12
  • Resolved: 2024-06-12
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
1. Run the attached code
2. Move mouse inside the TextField which is at the top of the window
3. Press and hold the mouse. Observe a mouse event with type "MOUSE_PRESSED" printed in the output.
4. Release the mouse. Observe a mouse event with type "MOUSE_RELEASED" printed in the output.
5. Move mouse inside the TextArea which is at the bottom of the window.
6. Press and hold the mouse. Observe no event printed. Expected behavior: a "MOUSE_PRESSED" event is printed.
7. Release the mouse. Observe no event printed. Expected behavior: a "MOUSE_RELEASED" event is printed.

Comments
Discussed the issue with the team, closing as WON'T FIX as it works as designed. One possible suggestion is to `addEventFilter()` to the text area, which should provide the desired functionality.
12-06-2024

No, it's unrelated to JDK-8231245. The mouse events are getting consumed by design - see ContentView class in TextAreaSkin:1219 So I see two possible actions: 1. mark this ticket as WON'T FIX works as designed, or 2. wait for my InputMap proposal for JDK-8314968 which would allow for adding event handlers with explicit priority, or 3. wait for alternative solution for JDK-8314968 which would bring priority to event handlers at the Node level, see https://github.com/openjdk/jfx/pull/1266
11-06-2024

Good question. I haven't checked it.
11-06-2024

what happens when the TextArea skin is recycled? This might fix the issue due to JDK-8231245
11-06-2024

This was originally filed as JDK-8163268 and closed as "not an issue" a few years ago. I went looking, and see these issues also: JDK-8087655: TextArea doesn't generate MOUSE_DRAGGED, MOUSE_PRESSED, MOUSE_RELEASED events JDK-8087845: TextArea.addEventHandler(... does not work for events: MouseEvent.MOUSE_DRAGGED, MouseEvent.MOUSE_RELEASED, MouseEvent.MOUSE_PRESSED We should either revisit this, or else document the fact that not all events can be listened to on all components. In the latter case, we would likely need to document which ones don't apply for each specific controls.
01-04-2022