# Bug OP-7411 - ScrollIntoView previous element 

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-7411

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 11.0.0 |
| Observed in versions |  |
| Sprint | 11.0.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

In some cases, when scrolling back from a wp detail page, the header of the workpackages table hides the scrolled into view element (the last opened wp (-checked)). Scrolling the previous element instead (if any) avoids this issue.

WorkPackageListViewComponent

*this*.ngZone.runOutsideAngular(() =\> {  
  *setTimeout*(() =\> {  
    *const* selectedRow = *this*.elementRef.nativeElement.querySelector('.wp-table--row.-checked');  
    *const* selectedCard = *this*.elementRef.nativeElement.querySelector('.wp-card.-checked');  
    *// The header of the table hides the scrolledIntoView element*  
*// so we scrollIntoView the previous element, if any*  
*if* (selectedRow && selectedRow.previousSibling) {  
      selectedRow.previousSibling.scrollIntoView({block: "start"});  
    }

*if* (selectedCard) {  
      selectedCard.scrollIntoView({block: "start"});  
    }  
  }, 0);  
});
