siemens / ix

Siemens Industrial Experience is a design system for designers and developers, to consistently create the perfect digital experience for industrial software products.
https://ix.siemens.io/
MIT License
203 stars 69 forks source link

ix-tree unloads items when scrolling down #1470

Open Nakiiii opened 1 month ago

Nakiiii commented 1 month ago

Prerequisites

What happened?

While I was working on a feature, I stumbled upon a weird behavior in ix-tree.

Background: I created a project with many items within the ix tree. This will enable the scrolling for the ix-tree. I wanted to access the items outside of the visible tree to scroll to them with the following (simplified) code: element = document.querySelector('[data-tree-node-id="${selectedItemId}"]') element.scrollIntoview()

This works fine when choosing an element that is currently in the view of the ix-tree as well as elements under the view when scrolling. An issue arises when trying to access the ix-items in the tree that are currently ABOVE the scrolled position of the view. These elements are unloaded in the DOM. Trying to access the item with the query selector will now result in receiving null.

The following image shows the tree and its first element at the very top. As you can see, the very first tree item in the developer console is the first item in the tree. All the items below the sample are loaded.

image

The next image shows the state of the tree when scrolled to the very bottom. Now, the first element in the developer console under the ix-tree element is the node nine. And every item above node 9 was unloaded, making it impossible to get an element with document.queryselector

image

What type of frontend framework are you seeing the problem on?

Angular

Which version of iX do you use?

v2.4.0

Code to produce this issue.

https://github.com/grollmus/ixtreeissue
danielleroux commented 1 month ago

@Nakiiii this is a intended behaviour, tree items which are not visible will not be attached to the DOM.

github-actions[bot] commented 1 month ago

🤖 Hello @Nakiiii

Your issue will be analyzed and is part of our internal workflow. To get informed about our workflow please checkout the Contributing Guidelines

JIRA: IX-1719