You found a bug! We've classified it as EXTGWT-2149 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    87
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default Modal dialogs can be bypassed

    Modal dialogs can be bypassed


    System: GXT 3.0.1/3.0.4; IE 9/Firefox 10.0.4

    Modal dialogs can be bypassed by using the tab key multiple times to move through all the masked form elements on the page.
    This behavior can be reproduced using an example from the GXT showcase (click the “Hello World” world button and then tab – you’ll find the search input field at the top left focused):
    http://www.sencha.com/examples/#ExamplePlace:helloworld

    It seems that you've fixed this issue in Ext JS recently:
    http://www.sencha.com/forum/showthre...l-is-not-modal

    Your showcase confirms the correct behavior:
    http://docs.sencha.com/ext-js/4-1/#!...tact-form.html

    It would be great to have a fix in GXT, too!

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    364
    Vote Rating
    14
    branflake2267 will become famous soon enough

      0  

    Default


    This should could be a workaround:

    1. Add a method to tell if the element is coming from the Window
    Code:
    private boolean isWindowEvent(Element element) {
      do {
        EventListener eventListener = DOM.getEventListener((com.google.gwt.user.client.Element) element);
        if (eventListener instanceof Window) {
          return true;
        }
        element = (Element) element.getParentElement();
      } while (element != null);
    
    
      return false;
    }
    2. Preview the events when the window is open and visible. And this will ignore tab events coming from everything but the window.
    Code:
    Event.addNativePreviewHandler(new NativePreviewHandler() {
      @Override
      public void onPreviewNativeEvent(NativePreviewEvent event) {
        String type = event.getNativeEvent().getType();
        EventTarget et = event.getNativeEvent().getEventTarget();
        Element element = et.cast();
    
    
        // ignore tab keys when not in window
        if (modalWindow != null && modalWindow.isVisible() && type.contains("key")
            && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB && !isWindowEvent(element)) {
          event.cancel();
        }
      }
    });
    Brandon

Thread Participants: 1