Announcement

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

    form item loses focus when clicking on empty area of another dynamic form

    Hello Isomorphic,

    We have some screens with a complex layout that contains multiple dynamic forms (organized in horizontal and vertical layouts).
    some of the fields in these dynamic forms have validators or other UI logic which is applied when the fields lose focus.
    We are noticing some inconsistency when the user is clicking in 'empty' parts of the screen - some clicks will make the current field lose focus (and trigger the validations etc.) and other clicks do not...
    To be clear - this is only when clicking in an empty area - obviously, when clicking on another form item or button, the current item always looses focus as expected.

    I tried to narrow down this problem to a simple example and came up with this snippet:

    Code:
    var f1 = isc.DynamicForm.create({
        autoFocus: true,
        validateOnExit: true,
        items:[
            {
                name: "name",
                title: "Enter your name",
                selectOnFocus: true,
                wrapTitle: false,
    
                validators: [{type: "required"}]
            },
            {
                name: "age",
                title: "Enter your age",
                selectOnFocus: true,
                wrapTitle: false
            }
        ]
    });
    
    
    var f2 = isc.DynamicForm.create({
        numCols: 3,
        backgroundColor: "lightgray",
        items:[
            {
                name: "address1",
                title: "Address line 1",
                selectOnFocus: true,
                wrapTitle: false,
            },
            {
                name: "address2",
                title: "Address line 2",
                selectOnFocus: true,
                wrapTitle: false
            },
            {
                type: "button",
                title: "Check Address",
                width: 80,
                startRow: false,
            }
        ]
    });
    
    isc.HLayout.create({
    members: [f1, f2]
    });
    Click image for larger version

Name:	focus.png
Views:	164
Size:	10.4 KB
ID:	266120
    When playing this example, the focus is defaulting to the name field.
    Clicking in any "white" area on the screen, will not affect the focus, but clicking in the "gray" area (the background of the second dynamic form) the name field will lose focus and show the "required" validation indicator.
    Of course in this example I deliberately highlited the second form with a gray background, but in our application all the forms have the same bg color so the user cannot distinguish between them and cannot really understand why some clicks do trigger the focus change (and subsequent validation) and others don't.

    In general, as a user I would expect that either any click outside the field will make the field lose focus or only clicks on a specific field\control will do that (with a clear preference for the second option).

    I am curios if you have any recommendation how to achieve this or whether you consider it a bug and will fix it.
    I originally thought that setting the dynamic form's canFocus to false would solve that, but according to your documentation, it does not meant to work.
    This property will only govern whether the form may receive focus if the form contains no focusable items.
    Thanks in advance
    Gil


    #2
    Hi Gedri
    In our testing we're not seeing exactly the behavior you describe.
    What appears to be happening here is that if you click on the title for an item, focus goes to that item (regardless of the background-color of the form - this happens for the "Enter Your Age" item as well as the "Address Line 2" item (and if you click on the grey area below that item you don't see focus shift).

    The reason for this is that item titles write out a <label for...> HTML tag, pointing to their target item.
    The item focus is a result of native browser behavior when clicking on any label element, so this is working as designed.

    We don't currently offer a way to suppress the label tag for titles, so if you want to avoid this behavior, your options right now would be to use styling to make the title more obvious or to write your titles in some other way (using embedded staticTextItems or similar).

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks for your response.
      I am not referring to clicking on the field titles - it is perfectly expected that clicking on a field title will set that field in focus and that works correctly.

      Please take a look look at this recording: https://share.getcloudapp.com/geuA0N1l

      You can see that when I click on the white area, the name field stays focused, but when I click in the gray area - but not on any field title, the name field looses focus.
      You can imagine how if the gray area was also white, the user would not be able to figure out why one click does not have any impact, but clicking few pixels above or to the left in an area which appears exactly the same, does affect the focus.

      Regards
      Gil

      Comment


        #4
        Hi Gedri
        Thanks for the clear follow up and screencast. We see the problem. It's Windows only which is how it was missed in our original testing.
        We'll get this fixed soon and follow up when we have a solution

        Regards
        Isomorphic Software

        Comment


          #5
          We've now made a change to address this issue. This change will be present in the next nightly build (dated Aug 18 or above) on the 12.1 branch

          Regards
          Isomorphic Software

          Comment

          Working...
          X