Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4091

Collapsing a Panel with invalidate causes a JavaScript error

    Details

      Description

      Steps to Reproduce

      Same as ZK-2035. (The issue was not fixed properly in my opinion)

      1. click panel button to collapse
        <zk>
        	<panel title="Panel" border="normal"
        		collapsible="true" width="150px">
        		<attribute name="onOpen"><![CDATA[
        			self.invalidate();
        		]]></attribute>
        		<panelchildren>
        			<button label="test button" />
        		</panelchildren>
        	</panel>
        </zk>
        

      Current Result

      An error in browser console

      TypeError: p is null; can't access its "getHflex" property

      Expected Result

      No error in browser console

      Debug Information

      https://github.com/zkoss/zk/blob/2c951ca4b65c0adf9100d4d0e304509b732ad6a1/zul/src/archive/web/js/zul/wnd/Panel.js#L814
      Collapsing a panel triggers an animation, before the animation finished the widget is invalidated.
      The afterAnima_ will be called after animation. But the widget is detached hence no parent.

      Workaround

      Avoid calling invalidate if an animation is included in a action.
      Or check this.desktop in afterAnima_

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              rudyhuang rudyhuang
              Reporter:
              rudyhuang rudyhuang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: