Opening/closing an treeitem scrolls the tree vertically in Firefox ver. 118

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Normal
    • None
    • Affects Version/s: 9.6.3, 9.6.4, 10.0.0-Beta
    • Component/s: Browser Issue
    • Security Level: Jimmy
    • Environment:

      Windows 10, Firefox ver. 118

    • None

      UPDATED TICKET 

       

      Steps to Reproduce

      1. https://zkfiddle.org/sample/2susg7b/1-Firefox-118-focus-scrolls-to-wrong-scroll-postion
      2. Run fiddle in FF 118
      3. scroll down to the middle of the tree
      4. open or close an item

      Current Result

      Tree scrolls up by half of a tree viewport

      Expected Result

      tree doesn't scroll

      Debug Information

      Caused by FF incorrectly scrolling the tree viewport to center the hidden focus button, instead of scrolling the tree viewport to put the hidden focus button tot the top of the viewport.

      fiddle sample uses a red border on the hidden focus to make it visible

      Triggering the behavior in FF causes the focus called on the button during zul.sel.Tree.prototype.focusA_ to scroll the button to the center of the viewport

      triggering the same behavior in other browsers  / versions bring the focus button to the top of the viewport instead.

      Workaround

      scrolls the viewport back to expect location after triggering button focus.

      	<script><![CDATA[
      	/*WORKAROUND*/
      	/**
      		 * Purpose: prevent unwanted scroll in FF
      		 * Based on version: 9.6.4
      		 * Last update: 9.6.4
      	 */
      	if(zk.version != '9.6.4'){
      	   console.warn('This override script version compatibility was tested for ZK 9.6.4. If you are running a different version, please check this script compatibility ');
      	}
      	zk.afterLoad("zul.sel", function () {
      	    var _xTree = {};
      	    zk.override(zul.sel.Tree.prototype, _xTree, {
      	        focusA_: function() {
      				var result = _xTree.focusA_.apply(this, arguments);
      				if(zk.ff)
      					this.$n("body").scrollTop = this._currentTop;
      				return result;
      	        }
      	     });
      	});
      ]]></script>
      

       

      ORIGNAL TICKET BELOW

      Steps to Reproduce

      Create a tree that will contain enough treeitems to display a vertical scrollbar. Treeitems must have children (so they can be opened/closed). Move the vertical scrollbar down to the item that was not visible. Open an treeitem - the item's position will change and you have to use the scrollbar to find the item. The same happens when closing an item.

      Current Result

      If the vertical scrollbar of the tree is not at the top, then opening/closing the item will change its position

      Expected Result

      The treeitem should stay in the same position after opening/closing.

      Debug Information

       
      I am sending a test index.zul file in the attachment

      Workaround

      The tree works correctly in an older version of Firefox or in the Chrome browser.

            Assignee:
            Unassigned
            Reporter:
            mondrus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: