Message List: Fix stuck date indicator (#5325)
This commit is contained in:
parent
984a058e38
commit
fafbfd9cfc
@ -25,11 +25,6 @@ export default function useStickyDates() {
|
||||
|
||||
runDebounced(() => {
|
||||
const stuckDateEl = findStuckDate(container);
|
||||
if (stuckDateEl) {
|
||||
requestMutation(() => {
|
||||
stuckDateEl.classList.add('stuck');
|
||||
});
|
||||
}
|
||||
|
||||
requestMutation(() => {
|
||||
const currentStuck = document.querySelector('.stuck');
|
||||
@ -37,6 +32,10 @@ export default function useStickyDates() {
|
||||
currentStuck.classList.remove('stuck');
|
||||
}
|
||||
|
||||
if (stuckDateEl) {
|
||||
stuckDateEl.classList.add('stuck');
|
||||
}
|
||||
|
||||
document.body.classList.remove('is-scrolling-messages');
|
||||
});
|
||||
});
|
||||
@ -58,6 +57,6 @@ function findStuckDate(container: HTMLElement) {
|
||||
return Array.from(allElements).find((el) => {
|
||||
const { offsetTop, offsetHeight } = el;
|
||||
const top = offsetTop - containerTop;
|
||||
return -offsetHeight <= top && top <= (headerActionsHeight || STICKY_TOP);
|
||||
return -offsetHeight <= top && top <= headerActionsHeight + STICKY_TOP;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user