Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll to the start of the given day #73

Closed
1 of 2 tasks
MadLittleMods opened this issue Sep 20, 2022 · 3 comments
Closed
1 of 2 tasks

Scroll to the start of the given day #73

MadLittleMods opened this issue Sep 20, 2022 · 3 comments
Labels
A-archive-room-view The view to look at a room day by day in the archive T-Enhancement New feature or request Z-Confidence-Low Low confidence in the enhancement or suggestion based on known factors, or as described.

Comments

@MadLittleMods
Copy link
Contributor

MadLittleMods commented Sep 20, 2022

Following up with the UX problems mentioned in #71, we should page-load the scroll position to the start of the day so the date header is just in view at the top.

Here is a mock-up using Element:

Mock-up using Element

Currently, the page is always scrolled to the very bottom.

Blockers

UX considerations

  1. What happens when there are no messages for the given day?
    • Any empty placeholder shown?
    • How does scroll work?
  2. What happens when there isn't enough messages to fill up the viewport?

Dev notes

It would be nice to have this functionality built-in to Hydrogen. Although permalinks to jump to a specific message aren't supported in Hydrogen and even if they did, they probably want to scroll the event to the middle of the view instead of at the top like we would.

Scratch code
scrollToEventId(rootElement, eventId, scrollIntoViewOptions) {
  const scrollRoot = rootElement.querySelector('.Timeline_scroller');

  const elementToScrollTo = scrollRoot.querySelector(
    `:scope > ul > [data-event-id="${eventId}"]`
  );
  console.log('elementToScrollTo', elementToScrollTo);
  elementToScrollTo?.scrollIntoView(
    scrollIntoViewOptions || {
      block: 'start',
      inline: 'nearest',
    }
  );
}

requestAnimationFrame(() => {
  this.scrollToEventId(rootElement, '$MRQON0wYqnapzYsa9XmAaxgB5qxvhLCC4Gd0ZuSSdpI');
});
@MadLittleMods
Copy link
Contributor Author

It's unclear if we actually want to do this. We kinda assume you will start from the bottom of the range from date/time specified in the URL.

It probably does make sense to have sticky date headers regardless though.

@bkil
Copy link

bkil commented May 29, 2023

Related: #238 #124

@MadLittleMods MadLittleMods added the Z-Confidence-Low Low confidence in the enhancement or suggestion based on known factors, or as described. label May 30, 2023
@MadLittleMods
Copy link
Contributor Author

Closing as Hydrogen has sticky date headers now which we're now using after #189

And as mentioned above, we assume you will start from the bottom of the range from date/time specified in the URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-archive-room-view The view to look at a room day by day in the archive T-Enhancement New feature or request Z-Confidence-Low Low confidence in the enhancement or suggestion based on known factors, or as described.
Projects
None yet
Development

No branches or pull requests

2 participants