JDK-8163268 : TextArea consumes some of mouse events
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2016-08-05
  • Updated: 2022-04-01
  • Resolved: 2016-08-08
Related Reports
Relates :  
Relates :  
Description
Reproducible: always
Regression: no
Platform-specific: no

Steps to reproduce: run attached sample and try:
1. Click on TextArea.
Expected events (among others): MOUSE_PRESSED, MOUSE_RELEASED
Actual result: only MOUSE_CLICKED event.
2. Perform mouse drag inside of TextArea:
Expected event: MOUSE_DRAGGED
Actual result: no MOUSE_DRAGGED event

So, user can't use TextArea.setOnMousePressed, TextArea.setOnMouseReleased, TextArea.setOnMouseDragged. TextArea.addEventHandler doesn't work for that methods either. 

Workaround: it it still possible to handle that events using TextArea.addEventFilter.

All this events are fired normally for TextField.

RULE "SceneGraphAutomated/test/scenegraph/events/TextAreaEventsTest/onMouseDraged" Exception org.jemmy.TimeoutExpiredException: State 'test.scenegraph.events.EventTestCommon$22...' has not been reached in ... milliseconds
RULE "SceneGraphAutomated/test/scenegraph/events/TextAreaEventsTest/onMousePressed" Exception org.jemmy.TimeoutExpiredException: State 'test.scenegraph.events.EventTestCommon$22...' has not been reached in ... milliseconds
RULE "SceneGraphAutomated/test/scenegraph/events/TextAreaEventsTest/onMouseReleased" Exception org.jemmy.TimeoutExpiredException: State 'test.scenegraph.events.EventTestCommon$22...' has not been reached in ... milliseconds

Comments
As Kevin notes, there should be no expectation that all events are available in all places. Many UI controls consume events in their ordinary work, and as such these aren't then available for other use.
08-08-2016

Tested with 8 GA and the behavior is the same.
05-08-2016

In general, you can't expect to get the raw mouse events on controls, since a control might consume them. Assign to Jonathan to confirm that this specific case is working as expected.
05-08-2016