Announcement

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

    ImgButton clickHandler not firing for FireFox

    SmartClient Version: SNAPSHOT_v8.3d_2012-09-20/Enterprise Deployment (built 2012-09-20)
    FF 12.0

    The ImgButton we use in our logon screen is no longer firing the ClickEvent in FireFox version 12.0. In IE8 and Chrome the event fires as expected. This problem surfaced only in the last few days, prior to that the event fired as expected.



    Here is the pertinent code:
    Code:
    		ImgButton logonButton = new ImgButton();
    		logonButton.setHeight( 41 );
    		logonButton.setWidth( 199 );
    		logonButton.setLayoutAlign( Alignment.CENTER );
    		logonButton.setShowRollOver( true );
    		logonButton.setShowDown( true );
    		logonButton.setShowDisabled( true );
    		logonButton.setSrc( "[SKIN]/btn-login.png" );
    		logonButton.setDisabled( true );
                    logonButton	.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
    
    					@Override
    					public void onClick(
    							com.smartgwt.client.widgets.events.ClickEvent event) {
    						login(getUsername(), getPassword());
    					}
    				});
    
                    loginLayout.addMember( logonButton );

    In our 'password' field we have a keypress handler that will fire a ClickEvent when the user presses Enter. This does work and I have verified that the onClick method of the ClickEvent does get executed.

    Here is the code for the password keypresshandler:
    Code:
    password.addKeyPressHandler( new KeyPressHandler()
    		{
    
    			@Override
    			public void onKeyPress(KeyPressEvent event)
    			{
    				clearErrorMessage();
    				if ( event.getKeyName().equals( "Enter" ) )
    				{
    					logonButton.fireEvent( new com.smartgwt.client.widgets.events.ClickEvent( logonButton.getJsObj() ) );
    				}
    			}
    		} );
    Thanks

    #2
    That's surprising. We have an engineer scheduled to take a look!

    Regards
    Isomorphic Software

    Comment


      #3
      Hi jventurini,

      We're not seeing a problem with click handlers in general in Firefox for ImgButtons.
      The sample code you posted has the button disabled, which would of course disallow the click event in all browsers. If you remove that line click works fine for us in Firefox.

      Here's our complete sample that demonstrates this:
      Code:
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.types.Alignment;
      import com.smartgwt.client.util.SC;
      import com.smartgwt.client.widgets.ImgButton;
      
      public class ClickFailTest implements EntryPoint {
      
          @Override
          public void onModuleLoad() {
              ImgButton logonButton = new ImgButton();
              logonButton.setHeight( 41 );
              logonButton.setWidth( 199 );
              logonButton.setLayoutAlign( Alignment.CENTER );
              logonButton.setShowRollOver( true );
              logonButton.setShowDown( true );
              logonButton.setShowDisabled( true );
              logonButton.setSrc( "[SKIN]/btn-login.png" );
      //        logonButton.setDisabled( true );
                      logonButton .addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
      
                          @Override
                          public void onClick(
                                  com.smartgwt.client.widgets.events.ClickEvent event) {
                              //login(getUsername(), getPassword());
                              SC.say("Log in Clicked");
                          }
                      });
      
      //                loginLayout.addMember( logonButton );        
             logonButton.draw();
             
          }
      
      }
      Most likely there is something else going on in your app - such as the button failing to be enabled in Firefox for some reason, but we can't hypothesize as to the cause (or even know whether it's an application level bug or a problem with the framework) without more information. The best way to proceed would be to take either the snippet above as a starting point, or your actual login page, and create a simple standalone entrypoint class which we could run that demonstrates the problem

      Thanks
      Isomorphic Software

      Comment


        #4
        I have created a stand-alone application to reproduce the problem. As noted earlier this only occurs in FireFox. Also note the version of SmartGWT libraries I am using (3.1d). I tried this with version 3.0p and it works fine.

        I attached the skin-styles.css because somehow styling is related to this problem. If you comment out the line 'loginLayout.setStyleName( "loginLayout" );' in LogonPage.java it will work (the logonButton will receive the click event). The question is why this style is causing a problem and only for FireFox. Very strange.
        Attached Files

        Comment


          #5
          We've assigned someone to look at this. In the immediate term, we would guess based on the test case that we will find that Firefox is reporting bad coordinates due to some of your CSS settings, possibly not just a single style but a combination; this may or may not be something we can realistically work around in the framework.

          So, while you are waiting for the full investigation, you might try eliminating box-shadow or replacing certain padding/margin settings with settings such as layoutMargin or left/top coordinates using absolute positioning in a Canvas container. This may be the solution you end up using anyway if the Firefox bug cannot be worked around in the general case.

          Comment


            #6
            I have tried eliminating one by one the CSS settings for the 'loginLayout' class and the only way to get the click event firing is to eliminate all the CSS settings - resulting in an empty CSS class:

            .loginLayout {
            }

            Of course this eliminates all the shadowing, gradients, border, etc. that my app requires.

            The second way to get the click handler to fire is to remove the line that sets the styling for the layout, ie delete this line:
            loginLayout.setStyleName( "loginLayout" );
            which is pretty much the same solution as #1.

            And the third way to get the click event to fire (with all the loginLayout CSS attributes set) is to use a slightly older version of the SmartGWT libraries (3.0p). Here is the description of that SmartClient version from the developers console:

            SmartClient Version: SC_SNAPSHOT-2012-03-20_v8.2p/Enterprise Deployment (built 2012-03-20)

            As soon as we upgrade to version 3.1d (SmartClient Version: SNAPSHOT_v8.3d_2012-09-20/Enterprise Deployment (built 2012-09-20)
            the problem comes back. However we need 3.1d for other fixes so there is no going back for us.

            Adding to this, we are less than 2 weeks away from code cut off for our first production release so this fix is pretty critical for us. Knowing that version 3.0p was working, hopefully will shed some light on this problem for you.

            Thanks for your help

            Comment


              #7
              From experimenting with your test case, it is clear that the padding specification on the loginLayout css style is causing the problem.
              If you remove the padding specification in that css style the problem goes away.

              You can get the same appearance by explicitly calling "setPadding(84)" on the loginLayout widget within your Java code.
              We are investigating exactly why this problem occurs and how best to fix it within the framework, but this should allow you to resolve the problem within your application.

              Regards
              Isomorphic Software

              Comment


                #8
                Thanks for the feedback. I have already taken the approach of disabling use of the CSS class and using the API to set padding/border/etc. programmatically to get around this problem in the interim.

                Comment


                  #9
                  We have found the cause of the bug and made a change to fix it.
                  The fix will be present in the next nightly build in this branch (dated September 27 or greater).

                  Please let us know if you continue to have problems with this.

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    What was done to fix this issue ??
                    Can you please provide the commit id.
                    We are having one legacy application which we cannot upgrade to new version of smartclient

                    Comment


                      #11
                      See SmartClient.com/builds, you can get the latest patched build for whatever version you’re on, as long as it isn’t end-of-lifed.

                      Comment

                      Working...
                      X