Bug 394765 - Focus-Lost misbehaviour in Text controls
Summary: Focus-Lost misbehaviour in Text controls
Status: RESOLVED WORKSFORME
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-11-21 07:01 EST by Marco Missfeldt CLA
Modified: 2013-02-08 05:57 EST (History)
1 user (show)

See Also:


Attachments
Snippet to reproduce the temp-focus-lost behaviour (1.70 KB, text/plain)
2012-11-21 10:34 EST, Marco Missfeldt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Missfeldt CLA 2012-11-21 07:01:00 EST
Last tested on RAP 2.0.0 M3
Browser used: Mozilla or IE - doesn't matter
It's only a RWT issue - SWT-Win32 works fine

1. I'm inside a Text control and press the TAB-Key to move to the next control.
2. *Two* focus-lost events occur while traversing the focus: One from the Text control and one from the next control in order (e.g. another Text or a Button, it doesn't matter).
3a. If this next control is e.g. a Button and press TAB again, another focus-lost occurs.
3b. If this next control is a Text too, no focus-lost event occurs at all when leaving it.

So the first error is that Text controls seem to fire not only their own focus-lost, but also a second focus-lost for the following control. And the second error is that in case of tabbing inside multiple Text controls the second focus-lost consumes the next focus-lost event from the following Text control.

The same behaviour occurs when I use the mouse to change focus. So it doesn't matter if I press (Shift-)TAB or click inside the next control.
Comment 1 Ivan Furnadjiev CLA 2012-11-21 07:44:28 EST
I can't reproduce it with Controls Demo -> Focus tab (tested with Firefox and Chrome on Windows 7). Could you try the Controls Demo too? Please provide a self-running snippet to reproduce the issue.
Comment 2 Marco Missfeldt CLA 2012-11-21 09:38:43 EST
I now found the reason why this behaviour occurs in my program: During the processing of the focus-lost event I blocked the UI via shell.setEnabled(false) to prevent further input while the entered text is processed. On both SWT and RWT the implication is that the active Text control loses the focus while the shell is disabled and gets it back afterwards. But then RAP behaves differently because tabbing out of that Text control afterwards doesn't fire a new focus-lost - in SWT it does, which is the expected behaviour.

My shell disabling might not be a good solution and not even neccessary while using in RAP mode, but I think that this behaviour can be considered a bug in RAP focus control.
Comment 3 Ivan Furnadjiev CLA 2012-11-21 09:48:49 EST
(In reply to comment #2)
> My shell disabling might not be a good solution and not even neccessary
> while using in RAP mode, but I think that this behaviour can be considered a
> bug in RAP focus control.

If you attach a simple snippet to reproduce the issue we will consider how to handle it. Without a snippet I can't do anything.
Comment 4 Marco Missfeldt CLA 2012-11-21 10:34:00 EST
Created attachment 223814 [details]
Snippet to reproduce the temp-focus-lost behaviour

This code tries to emulate the dual threading which we have in our mvc framework - the data processing is not done in the UI-Thread.
Enter text in t1 and tab to t2. You can see in the Console-Output that the disabling of the shell during processing leads to an additional focus-lost and -gained in t2. In RAP this leads to a missing focus-lost if you tab back to t1.
Comment 5 Marco Missfeldt CLA 2012-11-21 10:45:27 EST
Comment on attachment 223814 [details]
Snippet to reproduce the temp-focus-lost behaviour

Additional Comment: The problem is that it is difficult to reproduce our environment in a small code snippet. On SWT we use dual threading (so this is why I start the new Thread in the snippet. But if in RAP mode we don't use a new thread, so the code you see inside the "big" runnable instance would be called synchronously inside the focusLost. The ayncExecs are also executed directly then.
I understand that it's hard for you to comprehend and reconstruct, but I can't boil down our complex setup to a small snippet. If you don't get an idea now what could be different in RAP, please feel free to close this bug as not reproducable. I think we will find a workaround here in this case, because as I already mentioned I don't feel lucky with this shell disabling.
Comment 6 Ivan Furnadjiev CLA 2013-02-08 05:57:08 EST
I've tried to reproduce the issue today with RAP 2.0, but without luck. I will close it as WORKSFORME. Please reopen if you have more details about it.