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

fix in safari scroll overflow #228

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

PavelRazumov
Copy link

@codecov
Copy link

codecov bot commented Apr 22, 2021

Codecov Report

Merging #228 (7745599) into master (9b038b9) will increase coverage by 0.53%.
The diff coverage is 100.00%.

❗ Current head 7745599 differs from pull request most recent head 7b579fd. Consider uploading reports for the commit 7b579fd to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #228      +/-   ##
==========================================
+ Coverage   53.67%   54.20%   +0.53%     
==========================================
  Files          41       41              
  Lines         857      867      +10     
  Branches      304      306       +2     
==========================================
+ Hits          460      470      +10     
  Misses        341      341              
  Partials       56       56              
Impacted Files Coverage Δ
src/Dom/scrollLocker.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b038b9...7b579fd. Read the comment docs.

@PavelRazumov
Copy link
Author

@shaodahong , have you got some comment to review?

overflowY: 'hidden',
};

if (container === document.body) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we judge mobile?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaodahong , what do you mean? I don't understand, in a mobile view, body is also present in the DOM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should if (isMobile && container === document.body).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaodahong , It's bug actually for safari browser, for example, on IPhone (mobile device ) and IPad (tablet device) this defect is present, and i checked work of these devices, but don't know about Mac

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my desktop browser, everything is normal, so my suggestion is to add this fix to the mobile browser.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect-ipad-body

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaodahong , I checked on IPad with isMobile() flag and work incorrect

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaodahong on Tablet devices isMobile() -> return false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked on IPad with isMobile() flag and work incorrect

Yep, so we need judge like this

const isIosDevice = (/iP(ad|hone|od)/.test(window.navigator.platform)

if (isIosDevice) {
//...
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaodahong, on IPad devices now platform return MacIntel
image

@@ -17,6 +18,32 @@ const scrollingEffectClassNameReg = new RegExp(
'g',
);

let scrollPosition = 0;
const isIosDevice = /iP(ad|hone|od)|MacIntel/.test(window.navigator.platform);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need support ssr, so

Suggested change
const isIosDevice = /iP(ad|hone|od)|MacIntel/.test(window.navigator.platform);
const isIosDevice = canUseDom() && window.navigator &&
window.navigator.platform &&
(/iP(ad|hone|od)/.test(window.navigator.platform) ||
(window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1))`;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants