Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329639

Summary: No key event on text widget for SWT.ARROW_DOWN and SWT.ARROW_UP
Product: [RT] RAP Reporter: Stefan Sommer <tonprince>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan, rsternberg, stephan.leichtvogt, tbuschto
Version: 1.3   
Target Milestone: 1.5 M5   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 225764    
Bug Blocks: 330461    

Description Stefan Sommer CLA 2010-11-07 16:00:23 EST
Build Identifier: M20100909-0800

There are no key events fired for SWT.ARROR_DOWN and SWT.ARROW_UP on the RWT text widget.

Reproducible: Always

Steps to Reproduce:
text.addKeyListener(new KeyListener() {
  @Override
  public void keyReleased(KeyEvent e) {
    System.out.println("Key released");
  }

  @Override
  public void keyPressed(KeyEvent e) {
    System.out.println("Key pressed");
  }
});
Comment 1 Ivan Furnadjiev CLA 2010-11-08 03:59:02 EST
This is only a FF issue, isn't it?
Comment 2 Ivan Furnadjiev CLA 2010-11-08 10:55:10 EST
This is a known limitation of the key events implementation under FF (AsyncKeyEventUtil.js). There is no an easy fix and maybe we will not solve it in the close future.
Comment 3 Stefan Sommer CLA 2010-11-14 12:09:14 EST
Is there another way to handle arrow down events in a text field? I would like to set the focus to the popup shell for text completion.
Comment 4 Ivan Furnadjiev CLA 2010-11-15 03:30:27 EST
Stefan, In FF this is currently not possible without breaking something else.
Comment 5 Ralf Sternberg CLA 2010-11-16 06:15:43 EST
Stefan, are you using the JFace FieldAssist or a custom implementation? Maybe we could handle this case in the JFace layer...
Comment 6 Stefan Sommer CLA 2011-02-18 23:36:04 EST
Yes, I am using the JFace field assist and would like to solve it there somewhere but how?
Comment 7 Ivan Furnadjiev CLA 2011-08-29 05:11:54 EDT
*** Bug 356054 has been marked as a duplicate of this bug. ***
Comment 8 Stephan Leicht Vogt CLA 2011-11-17 05:26:43 EST
As I wrote in bug225764 the underlying bug in firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=333198) is solved (	fixed1.9.1 ). Shouldn't it be able to fix this bug now? Or is there still another problem? Thanks for any insight.
Comment 9 Stefan Sommer CLA 2011-11-17 07:09:54 EST
I didn't reproduce this bug again because I moved to GWT because of some limitation of RAP. I am looking forward to use RAP again in my next project :-)
Comment 10 Ivan Furnadjiev CLA 2011-11-17 07:22:18 EST
I rather prefer to keep this bug opened as the issue is still valid in RAP. Reopened.
Comment 11 Stephan Leicht Vogt CLA 2011-12-07 09:05:29 EST
I tried out, what would happen if I removed the untrustedKey-Check from the AsyncKeyEventUtil.js. The ArrowKeys do work in Firefox 9. So does also the ctrl-v/c in plain text fields.
Did it break something else? I do not know. What would I have to test? Do some tests exists, which would/could fail without the untrustedKey-Check? Please some insights. Else I would like it very much, if this code coud be removed.
Comment 12 Tim Buschtoens CLA 2011-12-16 11:10:43 EST
Synchronous key events with FF 2+ seem to work fine, so this might be a way to support it. The untrusted keys are still untrusted however, at least in FF8. To check this, uncomment the left/right keys in ASyncKeyEventUtil, add a key-listener to a text field and try to navigate with left/right. It wont work.
Comment 13 Stephan Leicht Vogt CLA 2012-01-10 07:08:00 EST
You are right. Left/right/up/down won't work anymore in the browser if it is in the active-keys from the active text field. But this won't be a problem if it is clearly stated in javadoc or RWT.ACTIVE_KEY (or better in the missing static-fields RWT.ARROW_LEFT etc.). We have many singleline text fields which listen to to up/down keys to open a new box or change the value. And now they don't work in firefox.
I vote for removing the untrusted key list.
Comment 14 Tim Buschtoens CLA 2012-01-10 08:47:48 EST
We are in the process of refactoring the key events completely, and this should no longer be and issue when we are done.
Comment 15 Stephan Leicht Vogt CLA 2012-01-10 08:49:09 EST
Well that would be a huge relieve. I'm looking forward to it.
Comment 16 Tim Buschtoens CLA 2012-01-12 04:47:05 EST
After fixing Bug 367871 this issue is finally fixed. Note that now it's no longer possible to prevent moving the carret with the arrow keys using the doit flag. Use the RWT.CANCEL_KEYS feature instead.
Comment 17 Stephan Leicht Vogt CLA 2012-01-12 11:14:17 EST
That's GREAT! Thank you very much. It works.