Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348559 - Active Keybinding do block default behavior
Summary: Active Keybinding do block default behavior
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.5 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 282449 338523 346597
Blocks:
  Show dependency tree
 
Reported: 2011-06-07 09:23 EDT by Stephan Leicht Vogt CLA
Modified: 2012-01-18 06:00 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Leicht Vogt CLA 2011-06-07 09:23:19 EDT
If you set DELETE to the active keys the default behavior, delete text in
textfields, does not work anymore.
Comment 1 Stephan Leicht Vogt CLA 2011-07-04 05:01:31 EDT
(In reply to comment #0)
> If you set DELETE to the active keys the default behavior, delete text in
> textfields, does not work anymore.

Additional info for reproduction (from talk with h.staudacher):
I have a keyEventListener on a Table which listens to SWT.DELETE. If I now open a form which has a textField the delete key doesn't work anymore because the event is blocked by the table.
Comment 2 Ralf Sternberg CLA 2011-07-04 06:05:11 EDT
Hi Stephan, not sure if I understand correctly. You added a key listener to the table using Control#addKeyListener() AND add the DELETE key to the active keys using Display#setData() with RWT.ACTIVE_KEYS? The latter is not necessary to get the key listener on the table to work.

If you add a key to the active keys, the browser's default behavior is suppressed, e.g. to omit the search popup on Ctrl-F. But it seems that this suppression is causing trouble, right?
Comment 3 Stephan Leicht Vogt CLA 2011-07-07 05:25:12 EDT
(In reply to comment #1)

Ok, this was wrong.
Correct way to reproduce it:

I have a dialog with a table and a textfield. For a delete-row-action on the table I add the DELETE key to the active keys using Display#setData() with RWT.ACTIVE_KEYS. Now it is not possible anymore to delete the text in the textfield using the DELETE key.
Comment 4 Stephan Leicht Vogt CLA 2011-07-07 05:27:44 EDT
(In reply to comment #2)
> Hi Stephan, not sure if I understand correctly. You added a key listener to the
> table using Control#addKeyListener() AND add the DELETE key to the active keys
> using Display#setData() with RWT.ACTIVE_KEYS? The latter is not necessary to
> get the key listener on the table to work.
> 
> If you add a key to the active keys, the browser's default behavior is
> suppressed, e.g. to omit the search popup on Ctrl-F. But it seems that this
> suppression is causing trouble, right?

Hi Ralf, please read comment 3. I hope you can follow my steps. I didn't use addKeyListener on the table.

Yes, it seems that this suppression is causing trouble for the "standard" keys like DELETE and possibly others like BACKSPACE or TAB.
Comment 5 Holger Staudacher CLA 2011-07-07 05:31:52 EDT
> 
> Hi Ralf, please read comment 3. I hope you can follow my steps. I didn't use
> addKeyListener on the table.

From my point of view this behaves the expected way. When you start listening on a key like the DELETE key you need to take care of all actions regarding the DELETE key. So, is there a reason why you aren't using a keyListener on the table? When you are using the keyListener you don't have to add the DELETE key to the ActiveKeys and your problem will probably vanish.
Comment 6 Stephan Leicht Vogt CLA 2011-07-07 05:44:40 EDT
(In reply to comment #5)
> From my point of view this behaves the expected way. When you start listening
> on a key like the DELETE key you need to take care of all actions regarding the
> DELETE key. 

Well, how can I know all possible actions regarding the DELETE key (or any other key in the ACTIVE_KEY set).

> So, is there a reason why you aren't using a keyListener on the
> table? 

Yes there is a reason. I can't specify which key the keyListener should listen to. If I add a keyListener to a control the browser would send just every key press and release to the server. I don't want that much traffic.
Comment 7 Ralf Sternberg CLA 2011-07-07 05:53:05 EDT
(In reply to comment #6)
> Yes there is a reason. I can't specify which key the keyListener should listen
> to. If I add a keyListener to a control the browser would send just every key
> press and release to the server. I don't want that much traffic.

There is a proposal to extend the ACTIVE_KEY mechanism to Widgets: bug 346597. This would probably be the solution to your problem, wouldn't it?
Comment 8 Stephan Leicht Vogt CLA 2011-07-07 05:59:33 EDT
(In reply to comment #7)
> There is a proposal to extend the ACTIVE_KEY mechanism to Widgets: bug 346597.
> This would probably be the solution to your problem, wouldn't it?

Yes, this seem to be the solution.
Comment 9 Tim Buschtoens CLA 2012-01-05 05:40:14 EST
Can this be considered fixed? Bug 346597 is fixed and ACTIVE_KEYS on display are no longer canceled automatically.
Comment 10 Stephan Leicht Vogt CLA 2012-01-05 05:45:03 EST
I'm struggling now with the opposite problem. I'm still working with the active keys on display. I have set DELETE as active key and cancel keys is empty/not set.
With HEAD I receive DELETE key event only on Textfield but not every keystroke. If focus is somewhere else, i.e. a table, DELETE key events do not reach the server.
Comment 11 Ivan Furnadjiev CLA 2012-01-18 05:46:13 EST
(In reply to comment #10)
> I'm struggling now with the opposite problem. I'm still working with the active
> keys on display. I have set DELETE as active key and cancel keys is empty/not
> set.
> With HEAD I receive DELETE key event only on Textfield but not every keystroke.
> If focus is somewhere else, i.e. a table, DELETE key events do not reach the
> server.
Just tested with display filter and ACTIVE_KEYS (DELETE) set on display and events are fired regardless of the focused control.

With the implementation of CANCEL_KEYS (bug 367869) the key added to the ACTIVE_KEYS list is not canceled automatically anymore.
I will closed it as FIXED. Please reopen if you the issue persists for you with the latest nightly runtime.
Comment 12 Stephan Leicht Vogt CLA 2012-01-18 06:00:19 EST
(In reply to comment #11)
> Just tested with display filter and ACTIVE_KEYS (DELETE) set on display and
> events are fired regardless of the focused control.
> 
> With the implementation of CANCEL_KEYS (bug 367869) the key added to the
> ACTIVE_KEYS list is not canceled automatically anymore.
> I will closed it as FIXED. Please reopen if you the issue persists for you with
> the latest nightly runtime.

I'll test it and would reopen this bug if necessary. Thanks for the heads up.