Without position: relative, .task-item offsetParent is the body element, causing offsetTop to be measured from document root rather than the scroll container. This makes scrollToTask calculate wrong scrollTop.
Without position: relative, .task-item offsetParent is the body element, causing offsetTop to be measured from document root rather than the scroll container. This makes scrollToTask calculate wrong scrollTop.