Profile: Fix header update on scroll (#5627)
This commit is contained in:
parent
b7b4e4811a
commit
5fb31e1603
@ -89,7 +89,7 @@ export default function useProfileState(
|
||||
}
|
||||
|
||||
let state: ProfileState = ProfileState.Profile;
|
||||
if (container.scrollTop >= tabListEl.offsetTop) {
|
||||
if (Math.ceil(container.scrollTop) >= tabListEl.offsetTop) {
|
||||
state = getStateFromTabType(tabType);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,9 @@ import { requestMeasure, requestMutation } from '../../../lib/fasterdom/fasterdo
|
||||
|
||||
import useLastCallback from '../../../hooks/useLastCallback';
|
||||
|
||||
// Sometimes px values are rounded
|
||||
const ROUNDING_COMPENSATION_PX = 1;
|
||||
|
||||
export default function useTransitionFixes(
|
||||
containerRef: { current: HTMLDivElement | null },
|
||||
transitionElSelector = '.Transition.shared-media-transition',
|
||||
@ -15,7 +18,7 @@ export default function useTransitionFixes(
|
||||
const transitionEl = container.querySelector<HTMLDivElement>(transitionElSelector);
|
||||
const tabsEl = container.querySelector<HTMLDivElement>('.TabList');
|
||||
if (transitionEl && tabsEl) {
|
||||
const newHeight = container.offsetHeight - tabsEl.offsetHeight;
|
||||
const newHeight = container.offsetHeight - tabsEl.offsetHeight + ROUNDING_COMPENSATION_PX;
|
||||
|
||||
requestMutation(() => {
|
||||
transitionEl.style.minHeight = `${newHeight}px`;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user