Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Escape aborts RPCManager request?


    Here's what's supposed to happen
    A user clicks a button which opens a custom class (Window)
    Within the initWidget of the window I use the RPCManager.sendRequest to fetch data needed to build the window
    On Callback of the sendRequest the window adds a few autochildren

    Here's the issue
    If a user clicks the button to open the window and then immediately presses escape, the send request (from the network tab) gets the status (canceled)
    That request is then handled by our system as an error so I want to disable the escape key until after the request callback.

    Here's what I tried
    I tried setting dismissOnEscape on the window to false
    I tried overridding cancelQueue on the RPCManager
    I tried implementing my own KeyDown on the window

    Any suggestions would be immensely helpful, thank you for your time


    SmartClient version (available on lower left of Developer Console)
    SmartClient Version: v11.0p_2017-02-16/Pro Development Only (built 2017-02-16)

    #2
    That's not normal. What browser on what platform is cancelling the request? You should try disabling any extensions as well.

    Where is keyboard focus at that moment? If it isn't in the Window, placing it in the Window will probably fix the issue and is better UI anyway.

    If you were to block this key press, you would mostly likely have to do it globally via the APIs on isc.Page.

    Comment


      #3
      Thanks for the quick response,
      I'm using Chrome 57.0.2987.133 on Windows

      The focus was probably already on the window but I manually set the focus on the window to be sure.
      I also the same test in a private session with all extensions disabled with the same result.

      Comment


        #4
        Set the focus on a specific component where focus makes sense, such as a button that performs the default action, or the first field of a form within the Window.

        This is, again, the right UE and will likely avoid your odd issue.

        As far as looking at whether it could be prevented in general, this hasn't been reported before and probably is an issue specific to your project. We'd need a minimal, ready-to-run test case to look into it as a possible framework issue.

        Comment


          #5
          I found out that this issue only exists in Chrome, unfortunately I can't seem to programatically set the focus to my window or any buttons within my window. I tried using this.focus() as well as autoFocus: true

          Comment


            #6
            I've narrowed the issue down to an HTMLPane that we use to show content from another local page. Does that help in any way?

            Comment


              #7
              The content loaded into the HTMLPane might be installing event handlers or similar.

              There should not be a problem placing focus on a button - that's really simple. Again we would continue to focus on getting that right, since again it's correct UE and probably will work around your problem with external content.

              Comment


                #8
                I hear you about the focus, unfortunately that's giving me issues as well.. It seems that the iFrame that the HTMLPane creates, steals the focus, so reguardless of where I set the focus, it will still end up causing the same issue..

                I've pulled this issue out into a sandbox and confirmed that the escape key will cancel the loading of an HTMLPane

                Code:
                isc.Button.create({
                    title: "open window",
                    click: function () {
                        isc.Window.create({
                            height: 500,
                            width: 500,
                            initWidget: function () {
                                this.Super("initWidget", arguments);
                
                                this.addItem(
                                    isc.HTMLPane.create({
                                        contentsType: "page",
                                        contentsURL: "http://www.smartclient.com/smartclient-release/isomorphic/system/reference/SmartClient_Reference.html#attr..RPCRequest.httpMethod"
                                    })
                                );
                
                                isc.RPCManager.sendRequest({
                                    httpMethod: "GET",
                                    actionURL: "https://httpbin.org/get",
                                    params: []
                                });
                            }
                        });
                    }
                });

                Comment


                  #9
                  You previously said that escape aborted an RPCManager request, which doesn't make sense, but yes, escape aborts the loading of pages, including pages in an iframe.

                  This generally can't be blocked if focus is in the iframe. So put focus elsewhere or, if you can modify the content in the iframe, add key handlers which will ignore the escape key.

                  Comment


                    #10
                    Sorry for the confusion, it's aborting both the RCManager requests and the HTMLPane page. I believe these are correlated because if I omit the HTMLPane contentsURL than the escape key does nothing and I have no issues.

                    I tried adding a key binding to the window of the iframe and I've tried setting the focus elsewhere with no luck. I'll keep trying

                    Comment

                    Working...
                    X