element-hq / element-hq/hydrogen-web
Sticky date headers in timeline
- Dominant language
- TypeScript
- Stars
- 714
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/vector-im/hydrogen-web/blob/master/prototypes/timeline.html uses `position: sticky`, but AFAICT, would require quite a bit of work to get the correct DOM structure (a wrapper per day).
We could also consider using an `IntersectionObserver` with a (negative?) top margin passed in [`rootMargin`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin) to lower the intersection to the bottom/top of the sticky date header and maintain a "flat" DOM structure. Date headers would be added/removed as they are mounted/unmounted to the shared `IntersectionObserver` for the timeline scroll area. IE11 does not support this, but it's probably fine consider this a progressive enhancement.
Contributor guide
Assessment
This issue has not been assessed yet.