# Feature OP-9053 - Scroll to oldest unread activity in the activity tab

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

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 12.0.0 |
| Sprint | 12.0.0 |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Parimal Satyal |
| Accountable | Henriette Darge |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

**Acceptance criteria**

When the user has unread notifications in a Work Package and the Work package is opened:

- [ ] Make the tabs (Activity, Relations, Watcher ...) in the full view sticky, so that when scrolled, they are still visible.
- [ ] Always scroll to the **oldest** unread notification and leave some space for the activity before (to create more context).
  - [ ] Keep in mind the user's individual order settings (chronological/reverse chronological). So either the space needs to be above or below the shown notification
- [ ] In case a deep link is followed including an activity anchor, the activity anchor overrules the notification scrolling.
- [ ] The behaviour should apply for split view and full view

**Technical notes (taken from <mention class="mention" data-id="38339" data-type="work_package" data-text="#38339">#38339</mention>)**

It is relatively easy to scroll to the right element via JS, by setting the `scrollTop` on the tab content. This works on mobile and tablet without changes, since there the parent does not scroll at all, so we will not have to write any special case code.

Note Oliver: Instead of `scrollTop` , also take a look at `element.scrollIntoView` in combination with the CSS property `scroll-margin`. It might be easier to implement. References: [(1)](https://css-tricks.com/almanac/properties/s/scroll-margin/), [(2)](https://newbedev.com/scrollintoview-with-margin)

Suggestion for the deep link behaviour: Don't check for a hashbang in URL, but rather just see if the tab content is already scrolled. If no, do our own scrolling. If yes, don't trigger our scrolling.
