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

button stealing focus

XMLWordPrintable

      Steps to Reproduce

      focus-label-autodisable-1.zul

      click "with autodisable"

      after ZK-4866, try this case: https://zkfiddle.org/sample/1vi7oet/1-focus-with-autodisable

      Current Result

      the button changes it's label -> OK
      the label gets focused -> OK
      (sometimes - style is flickering for a fraction of a second)
      the button receives the focus after a short time "stealing" the focus from the label

      Expected Result

      the label remains focused

      when pressing the second button "no autodisable' or 'no label change'

      Debug Information

      this happens when the button has both autodisable enabled and a changing label at the same time

      Workaround

      when focusing native dom elements directly zk.currentFocus needs to be cleared.
      (not necessary when using client side Widget.focus(), or server side focusing)

      <button label="with autodisable" autodisable="self" xmlns:w="client">
       <attribute name="onClick"><![CDATA[
       self.setLabel("updated label" + new Date());
       ]]></attribute>
       <attribute w:name="onClick"><![CDATA[
       // shall clear zk.currentFocus to prevent focus restore to the auto disabled button
       zk.currentFocus = null;
       zk.$('$title').$n().focus();
       ]]></attribute>
      </button>

       

            Leon03 Leon03
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: