Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3200

Cannot intercept left or right keypress on a div

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 8.0.0, 8.0.1
    • None
    • None

      Hello,

      I developped an application on zk 7 and i would like to migrate to zk 8.
      Everything works well. We have just a regression with a functionnality.
      In our application, we intercept left or right key press on a div in order to show the next screen or the previous screen (like a powerpoint presentation).
      This functionnalité works well in zk 7.0.8 but not on zk 8.0.0.
      I reproduced the bug with the sample code below.

      <zk>
          <div id="layout" apply="app.controller.TestController" ctrlKeys="#left#right">
          	<label value="this is a test"/>
          </div>
      </zk>
      
      package app.controller;
      
      import org.zkoss.zk.ui.event.KeyEvent;
      import org.zkoss.zk.ui.select.SelectorComposer;
      import org.zkoss.zk.ui.select.annotation.Listen;
      import org.zkoss.zul.Div;
      
      public class TestController extends SelectorComposer<Div> {
      
      	@Listen("onCtrlKey = #layout")
      	public void onKeyPress(KeyEvent event) {
      		if (event.getKeyCode() == 27) {
      			System.out.println("keyCode = 27");
      		} else if (event.getKeyCode() == KeyEvent.LEFT) {
      			System.out.println("keyCode = "+KeyEvent.LEFT);
      			
      		} else if (event.getKeyCode() == KeyEvent.RIGHT) {
      			System.out.println("keyCode = "+KeyEvent.RIGHT);
      		}
      	}
      }
      
      

      Is it a bug ? Or ZK 8 introduce a new concept on the keyEvent processing ?

      Regards
      Guillaume

            Unassigned Unassigned
            guisimon guisimon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: