mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Workaround iOS bottom overscroll bug in header-offset calcs (#30895)
This commit is contained in:
parent
5ac308fe85
commit
076c0c4bca
@ -105,7 +105,16 @@ export default class GlimmerSiteHeader extends Component {
|
|||||||
let headerWrapBottom =
|
let headerWrapBottom =
|
||||||
this._headerWrap.getBoundingClientRect().bottom - overscrollPx;
|
this._headerWrap.getBoundingClientRect().bottom - overscrollPx;
|
||||||
|
|
||||||
// While scrolling on iOS, fixed elements can have a viewport position which fluctuates between -1 and 1.
|
// iOS Safari bug: when overscrolling at the bottom of the page on iOS, fixed/sticky elements report their position incorrectly.
|
||||||
|
// Clamp the headerWrapBottom to the minimum possible value (top + height) to avoid this.
|
||||||
|
const minimumPossibleHeaderWrapBottom =
|
||||||
|
headerCssTop + this._headerWrap.getBoundingClientRect().height;
|
||||||
|
headerWrapBottom = Math.max(
|
||||||
|
headerWrapBottom,
|
||||||
|
minimumPossibleHeaderWrapBottom
|
||||||
|
);
|
||||||
|
|
||||||
|
// Safari bug: while scrolling on iOS, fixed elements can have a viewport position which fluctuates by sub-pixel amounts.
|
||||||
// To avoid that fluctuation affecting the header offset, we subtract that tiny fluctuation from the header-offset.
|
// To avoid that fluctuation affecting the header offset, we subtract that tiny fluctuation from the header-offset.
|
||||||
const headerWrapTopDiff =
|
const headerWrapTopDiff =
|
||||||
this._headerWrap.getBoundingClientRect().top -
|
this._headerWrap.getBoundingClientRect().top -
|
||||||
|
Loading…
Reference in New Issue
Block a user