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

Bug/59458 activity tab does not scroll to the bottom or correct comment on mobile #17374

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,18 @@ export default class IndexController extends Controller {
private tryScroll(activityId:string, attempts:number, maxAttempts:number) {
const scrollableContainer = this.getScrollableContainer();
const activityElement = document.getElementById(`activity-anchor-${activityId}`);
const topPadding = 70;

if (activityElement && scrollableContainer) {
scrollableContainer.scrollTop = activityElement.offsetTop - 70;
scrollableContainer.scrollTop = 0;

setTimeout(() => {
const containerRect = scrollableContainer.getBoundingClientRect();
const elementRect = activityElement.getBoundingClientRect();
const relativeTop = elementRect.top - containerRect.top;

scrollableContainer.scrollTop = relativeTop - topPadding;
}, 50);
} else if (attempts < maxAttempts) {
setTimeout(() => this.tryScroll(activityId, attempts + 1, maxAttempts), 1000);
}
Expand Down
Loading