Temzasse / react-modal-sheet

Flexible bottom sheet component built with Framer Motion to provide buttery smooth UX while keeping accessibility in mind πŸͺ
https://temzasse.github.io/react-modal-sheet/
MIT License
791 stars 75 forks source link

Black space appears when mobile keyboard is visible #47

Closed navnis closed 1 year ago

navnis commented 2 years ago

If we will try to pull the sheet upwards forcefully Black space appears when the mobile keyboard is visible. Black space is visible just above the keyboard.

Browser(Android)- Chrome(92.0.4515.159) Browser(iOS)- Safari react-model-sheet (v1.4.1)

In iOS IMG_2338

In Android Screenshot_2021-09-10-13-41-07-648_com android chrome

Temzasse commented 2 years ago

Hi @navnisπŸ‘‹

This doesn't seem to be happening in the example app (at least on my iPhone) so it's a bit difficult to tell what is happening on your end.

Default keyboard:

image

SwiftKey keyboard:

image

Can you provide a reproduction eg. in CodeSandbox?

navnis commented 2 years ago

Hey @Temzasse

You can go to Teasit And then you can follow the steps from the videos that I have attached to recreate that scenario...

Android

https://user-images.githubusercontent.com/38049137/133081818-9d2ea116-f25f-4be9-a124-468103d5f307.mp4

https://user-images.githubusercontent.com/38049137/133082165-e1f6334f-d861-446a-b2df-c456e491e251.mp4

iOS

https://user-images.githubusercontent.com/38049137/133083599-8181e2f6-dd9c-4207-92f4-e49bc2cd1e47.mp4

navnis commented 2 years ago

Hey @Temzasse

In your example app also this issue persists... I have attached the video...

scenario - I tried to scroll on the right side of the sheet...

OS - iOS Browser - Safari

https://user-images.githubusercontent.com/38049137/133111392-1a7bec5c-54f5-4076-b7e6-b612711dee9d.mp4

alex-cory commented 2 years ago

This is also happening in the example app for me.

https://user-images.githubusercontent.com/5455859/133119350-7991b596-296a-4b70-8ab3-b290e7a92626.mp4

Temzasse commented 2 years ago

I have quite limited amount of time to work on this lib at the moment so it would be amazing if someone could help me out by figuring out the reason for this issue and then create a PR πŸ˜„

I think the most likely cause for these scrolling related issues has something to do with body scroll locking. Framer Motion should automatically lock body scrolling for any gestures that are applied to draggable elements but clearly it's not working 100% robustly in all cases.

shivamragnar commented 2 years ago

Hey @Temzasse was there any updates on this one? I tried debugging this but not yet found a way around this.

Temzasse commented 2 years ago

@shivamragnar unfortunately I don't have the bandwidth to investigate issues like this which are not easily reproducible 😞 I could not reproduce this when I initially tried to debug it so it is very difficult to fix something you can't reproduce.

shivamragnar commented 2 years ago

@Temzasse It's alright, but it can be easily seen in the example app specifically in Slack Message example in iOS Safari.

niklasgrewe commented 2 years ago

i think you need to set a min-height: 100vh to the html element.

atlasbc commented 2 years ago

This issue is probably caused by y value being smaller than 0. Since y value makes transform: translateY(y), being it smaller than 0 makes action sheet container float. Could it be solved by restricting minimum y value to 0? @Temzasse. y value becomes smaller than 0 because window.height changes when screen keyboard pops up.

Temzasse commented 1 year ago

@atlasbc good suggestion about restricting the minimum value for y to be 0 πŸ‘πŸ» I'll investigate how this can be done with Framer Motion.

Temzasse commented 1 year ago

Restricting the y value didn't help. It seems that this is a "feature" in iOS Safari and not really a bug in the library: https://stackoverflow.com/questions/56351216/ios-safari-unwanted-scroll-when-keyboard-is-opened-and-body-scroll-is-disabled

Temzasse commented 1 year ago

Using a better body scroll locking implementation from React Aria (usePreventScroll) seems to mitigate this issue. I also added the y value restriction just to be safe. Hopefully this is now fixed in v1.6.2.