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

    Canvas#setStyleName(String style) has unexpected behavior on Firefox


    Version info
    Firefox 94.0.1 (64-bit)
    SmartGWT v12.1p_2021-02-23
    SmartClient Version: v12.1p_2021-02-23/Enterprise Deployment


    We noticed some strange drawing behavior specifically to firefox where the root cause was found to be calling canvas.setStyleName("someStyle") to early.
    Not calling setStyleName at all did not produce this behavior but that is not an option for us.
    Calling setStyleName with some non existing css class name also caused the behavior.
    The result was part of the layout going out to far right/left and cutting off as seen in this screenshot.
    Click image for larger version

Name:	image-2021-10-28-16-57-48-212.png
Views:	137
Size:	89.4 KB
ID:	266926

    I took a look at the SmartClient js source code and noticed another method is called when calling setStyleName, namely

    adjustOverflow : function (reason, delayed, fromRedraw) {
    where I also saw some
    implementation, not sure why or what it does.

    Our Workaround
    I stopped debugging the smartclient js code and tried
    mainLayout.addDrawHandler[I]([/I]ignored -> mainLayout.addStyleName[I]([/I]styleName[I]))[/I];
    in our code which did the trick.

    Let me know if I can be of more assistance or provide more information.


    Hello Jeno, if you believe you have discovered a bug in our software, then the next step is to give us a way to reproduce the problem.

    Unfortunately a screenshot doesn't help, nor does pointing to elementary parts of the JS code - these are very basic core methods, with which we are very familiar :) and which many projects use with success every day. Something is special about your usage, causing a problem no one else is having.

    With so little to go on, we can only speculate as to the cause - you may be using CSS invalidly as described here, or you might be doing something like loading a stylesheet after the style name has already been implied (in other words, while it was not a valid style name). So, a way to reproduce the problem is what we need.