Announcement

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

    Question about keyDown and keyPress on SelectItem

    Hi,

    We have a question regarding to keyDown and keyPress event for SelectItem. We are trying to show picklist of a SelectItem by pressing the "Enter" key when it has focus. However, we notice that if we use the keyPress event, it works. If we use keyDown event, it doesn't work.

    Our question is
    1. Is this a default behavior or an issue?
    2. Since in our product we are only using the keyDown event currently, if we introduce both keyDown and keyPress event for the SelectItem, will it cause any potential problem?

    Please try the standalone with following steps:

    1. Put focus on "Item Name" field, press enter and the picklist is not shown but option "A" is select.
    2. Put focus on "Item Name 2" field, press enter and the picklist is shown as expected.

    This behavior can be reproduced on SmartClient v8.3p_2014-10-23 build and SmartClient v9.1p_2014-09-16 build on IE9, Firefox 12 and Chrome.

    Thanks,
    Robin

    Code:
    isc.DynamicForm.create({
        ID:"testForm",
        width: 500,   
        fields : [
        {  ID:"testSelect",
            title: "Item Name", editorType: "select",
            valueMap: {"1":"A", "2":"B", "3":"C"},
            keyDown: function(item, form, keyName) { if (keyName == "Enter") {item.showPickList();} return true; }},
        {  ID:"testSelect2",
            title: "Item Name 2", editorType: "select",
            valueMap: {"1":"A", "2":"B", "3":"C"},
            keyPress: function(item, form, keyName) { if (keyName == "Enter") {item.showPickList();} return true; }}]
    });

    #2
    showPickList() is not actually a documented or supported method, because whether and when the pickList should be shown is complicated by lots of factors including waiting for network responses and auto-sizing. It's not surprising, given all the logic involved, that an attempt to show the picklist on keyDown might not work.

    Aside from the fact that your handlers are calling an undocumented method, it shouldn't be a problem to add both a keyDown and keyPress handler.

    Comment


      #3
      Thanks for the quick response. According to the comment "an attempt to show the picklist on keyDown might not work", is there any suggestion so that we can show picklist of a SelectItem by pressing the "Enter" key when it has focus? Thanks!

      Comment


        #4
        Not really, sorry. As we mentioned, showPickList cannot reasonably be made a public API, and we have not made any accommodation in the framework for switching the default key that opens the pickList, since using something like Enter violates accessibility standards and would break features like saveOnEnter.

        So you could either sponsor an enhancement to be able to set alternate key sequences to open the pickList, or make and maintain a source-level patch.

        Comment


          #5
          Thanks for the answer!
          Last edited by Rchu; 12 Nov 2014, 11:18.

          Comment

          Working...
          X