Announcement

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

    selectonfocus: true selects complete value on mouse click

    Hi,
    In my build of the 17th (will try the latest build later), if I have selectOnFocus on true then the complete value gets selected when clicking with the mouse. I would expect that a mouseclick would not select the complete value but put the cursor at the click position.

    I can reproduce on the smartclient demo:
    http://localhost:8080/isomorphic/system/reference/SmartClient_Explorer.html#textItem

    Code:
    isc.DynamicForm.create({
        width: 300,
        fields: [
            {title:"Item", type:"text", selectOnFocus: true} 
        ]
    });
    I tried on chrome 12 and FF5 on Linux ubuntu. What I do:
    - I type something in the text box
    - click on the js tab, click back on the view tab
    - click on a specific location in the field, the complete value gets selected

    Note it does not happen all the time, it happens every second time, so click, tab and then click will reproduce it.

    gr. Martin

    #2
    Let us know if this is reproducible outside of the Feature Explorer (which is a specialized environment).

    Comment


      #3
      Hi,
      The code reproduces it, in chrome I consistently get a complete select on mouse click, in ff it happens 2 out 3 times, in ie on windows 7 it happens all the time:
      - I first click in the field to enter a value
      - then click outside of the field on the page
      - then click in the field again, the complete value gets selected

      Code:
      <html>
      <head>
        <script>var isomorphicDir="../js/isomorphic/";</script>
        <script src="../isomorphic/system/development/ISC_Core.js"></script>
        <script src="../isomorphic/system/development/ISC_Foundation.js"></script>
        <script src="../isomorphic/system/development/ISC_Containers.js"></script>
        <script src="../isomorphic/system/development/ISC_Grids.js"></script>
        <script src="../isomorphic/system/development/ISC_Forms.js"></script>
        <script src="../isomorphic/system/development/ISC_DataBinding.js"></script>
        <script src="../isomorphic/skins/Enterprise/load_skin.js"></script>
      </head>
      <body>
      
        <script>
        isc.DynamicForm.create({
          width: 300,
          fields: [
              {title:"Item", type:"text", selectOnFocus: true} 
          ]
      });
        </script>
      
      </body>
      
      </html>
      Looking at the code, it seems that SC code does element.select without checking if a mouseclick is the cause of the event, in FormItem.focusInItem, which gets called on native focus events also.

      gr. Martin
      Last edited by martintaal; 22 Jul 2011, 22:29.

      Comment


        #4
        Bump, did someone have time to take a look?

        Thanks!

        gr. Martin

        Comment


          #5
          Sorry for not letting you know, it's queued for someone to look at but it's been assigned a low priority. It's an interesting effect, but does it have real world consequences? Typically selectOnFocus is only used in rare cases where this effect doesn't matter (like a one-line modal input dialog).

          Comment


            #6
            Hi,
            For us it is important for user productivity. I use it for this usecase (which occurs many many times in our app):
            - when a user selects something from a drop-down/suggestion box then the focus moves automatically to the next field
            - in the next field the complete value should be selected

            Also when a form opens and the first field gets the focus the complete value should be selected.

            I achieve this by setting selectOnFocus to true (only for textareas I set it to false). Is there maybe another way?

            I tried to do this next value selection explicitly by calling selectValue, but I noticed that the selection was not maintained on redraws. This gave the result that I shortly saw a value being selected and then the selection got lost on redraws.

            Also on IE the selection of a value did not always seem to work with selectValue while selectOnFocus worked fine.

            gr. Martin

            Comment


              #7
              We've added a fix for this issue. See the latest nightly under http://www.smartclient.com/builds/SmartClient/8.x
              Let us know if you continue to encounter the problem

              Thanks
              Isomorphic Software

              Comment


                #8
                Hi,
                I am afraid I still see this behavior in the 8.1 build.

                I am using the nightly 8.1 build of the 9th of september, there selectOnFocus=true will still select the complete value when clicking with the mouse in a field.

                gr. Martin

                Comment


                  #9
                  Hi, thanks for the replies on the other posts, this selectOnFocus topics also has my special interest, so I hope you had time to take a look.

                  If this works then I can remove all kinds of custom code I have to get focus handling to work as I want.

                  For my company focus handling is very important as it greatly increases (or reduces if done wrongly) user experience and data entry efficiency.

                  gr. Martin

                  Comment


                    #10
                    Understood.
                    The fix was made in mainline and never got ported to the 8.1 branch for you. We're taking care of this today so the fix should show up in the next nightly (8.1.x) build.
                    Let us know if you continue to have trouble with it

                    Comment


                      #11
                      Hi,
                      we've had the same problem after upgrade to smartGWT 2.5.
                      It seems it was fixed in some nightly build (tried on: /builds/SmartGWT/2.x/LGPL/2011-10-09).
                      Unfortunately, we can hardly use nightly builds in our app. So, do you think, there will be some stable version released soon? :) Or some minor bug fix (hotfix) release, that we can calm down our team leader? ;)
                      Thanks a lot for the answer.

                      Comment

                      Working...
                      X