RFR: 8306119: Many components respond to a mouse event by requesting focus without supplying the MOUSE_EVENT cause [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon May 29 05:58:24 UTC 2023


On Mon, 29 May 2023 04:43:44 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> I see concerns related to SwingUtilities2 and Accessibility in https://bugs.openjdk.org/browse/JDK-8306119 description. If we are not handling them in this fix, do we have separate JBS bug for them?

As of now, I will let Accessibility team handle the change in a separate JBS issue. Also SwingUtilities concern is to add additonal method which will need CSR which should be handled as separate issue again, so not handled here..

> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java line 325:
> 
>> 323:                 model.setPressed(true);
>> 324:                 if(!b.hasFocus()) {
>> 325:                     b.requestFocus(FocusEvent.Cause.MOUSE_EVENT);
> 
> Can this action be performed using a keyboard or this can be reached only using mouse press?
> If this actionPerformed can be reached using keyboard, i think we should add appropriate checks before throwing the focus event cause.

I have removed this contentious change as it probably can be used using keyboard too.  For now, just kept the other mouse only focus event cause in this file..

> test/jdk/javax/swing/event/FocusEventCauseTest.java line 59:
> 
>> 57:                 frame = new JFrame("FocusEventCauseTest");
>> 58:                 JPanel panel = new JPanel();
>> 59:                 button1 = new JButton("Button1");
> 
> Generic test comment. Its good if we can check focus event for all UI components that are getting updated.

Actually, the fix is trivial, the test is only added to show how the cause whould be presented to the user using a widget.
The other widgets would be same in showing focus cause event to be MOUSE_EVENT so not handled separately..

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14004#issuecomment-1566588152
PR Review Comment: https://git.openjdk.org/jdk/pull/14004#discussion_r1208932596
PR Review Comment: https://git.openjdk.org/jdk/pull/14004#discussion_r1208931915



More information about the client-libs-dev mailing list