angular-tree-component icon indicating copy to clipboard operation
angular-tree-component copied to clipboard

After checking(selecting) root node, the scrollbar moves to top.

Open Roman-Simik opened this issue 6 years ago • 5 comments

Hi, I recently discovered this bug, and it is pretty annoying.

Current behaviour:

After selecting the root node (with atleast one child) in the tree, the scrollbar moves automatically to top.

It only happens, when the root node has atleast 1 child and only when you are selecting it. How to reproduce - Scroll for example to the end of the 1st tree and select any root node with atleast 1 child.

Expected behaviour:

After selecting the root node (with atleast one child) in the tree, the scrollbar should stay at the same position.

If you for example scroll into the end of the 2nd tree and then select any root node, it stays at the same position, like it should.

Reproduce

StackBlitz

Additional Info

  • Paste your package.json - "angular-tree-component": "^8.2.0" (everything you can see in the StackBlitz repro)
  • Which browser - Tried it on Chrome, Edge, IE, Opera. So I think, this bug is in every browser.

Roman-Simik avatar Jan 28 '19 12:01 Roman-Simik

Hi, I had the same issue and I solved it by adding scrollContainer to my options:

options: ITreeOptions = {   
    scrollContainer: <HTMLElement>document.body
  };

srdex avatar May 08 '19 14:05 srdex

@srdex thanks, that helped :), but it should be already fixed by default and not by doing this.

Roman-Simik avatar May 10 '19 13:05 Roman-Simik

What is the status? Is it gonna be fixed anytime soon?

ghanashyam-c-k avatar Nov 08 '19 07:11 ghanashyam-c-k

Try to add 'scrollOnActivate: false' in the options.

MicheleMallia avatar Feb 26 '21 09:02 MicheleMallia

Could the scrollContainer value be an expression? Because the scrollable container is initialized at the same time with the tree and there is no way (I wasn't able to find) to change it after init.

liesahead avatar Mar 25 '21 14:03 liesahead