-
Notifications
You must be signed in to change notification settings - Fork 46.4k
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
[Gatsby Docs Update] Fixed iOS overscroll issues, and redesigned mobile sidebar button to … #10761
[Gatsby Docs Update] Fixed iOS overscroll issues, and redesigned mobile sidebar button to … #10761
Conversation
Deploy preview ready! Built with commit 9beb61f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some ways, I like the floating button style!
However it does have the downside of truncating titles that are longer than a word or two, (which includes a lot of titles).
The new touch logic also makes the Android experience worse. The first scroll attempt (up or down) gets blocked. The second one works. But then trying to scroll in the opposite direction is blocked on the first try also. This doesn't seem to happen on the main gatsby branch.
I don't actually have an iPhone charged to test what you're fixing at the moment, but I'll plug mine in now so I can try it out after lunch.
document.addEventListener('touchmove', this.handleDocumentTouchMove); | ||
document | ||
.querySelector('.scrollable') | ||
.addEventListener('touchstart', this.handleSidebarTouchStart); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong initial dislike to all of the global handlers/selectors here. If we have to do this, I think we should wrap it up in a separate component rather than mix it into the sticky component.
Ideally we could do this in a more "React" way (with props/refs) but I'd have to think about that a bit more. Might be harder to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit:
I see you did add a comment and link below - still might be good to comment here too.
It might be possible to make it a bit more 'React' ish. For now we could start by adding a comment and linking to the blog post that describes this fix for the iOS overscroll bug. (http://blog.christoffer.online/2015-06-10-six-things-i-learnt-about-ios-rubberband-overflow-scrolling/)
|
||
css.global('.is-menu-open #header', { | ||
transform: 'translateY(-100%)', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to avoid global styles for this. I suggest we pass an isOpen
prop do this component instead and (probably) expose a toggle function to the sticky sidebar via context. (I'll be happy to help implement this change.)
www/src/components/Flex/Flex.js
Outdated
@@ -25,11 +25,13 @@ const Flex = ({ | |||
shrink = 1, | |||
type = 'div', | |||
valign = 'flex-start', | |||
className, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Alpha-sort props 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Brian's suggestions about making things less global. That could be done in a follow-up, and/or Brian or myself could pick it up, shouldn't block merging this imo.
Thanks for tracking down a fix for this iOS issue!
I haven't manually tested this with Android, but can we figure out and try to fix the issue Brian mentioned with scrolling there? I would merge this if Android and other browsers are all functional with this change.
|
@Mathspy Thank you! It's on the list 👍 |
…accommodate Safari inert 44px
0fb9154
to
87cc5c5
Compare
www/src/templates/docs.js
Outdated
@@ -30,7 +30,7 @@ const sectionList = sectionListA | |||
}), | |||
); | |||
|
|||
const Docs = ({data, location}) => ( | |||
const Docs = ({data, location}) => console.log('render Docs') || ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't fire when you resize the window (above xsmall)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just manually tested on Android 7.0, Samsung Galaxy S6. Looks and feels pretty good! It seems like there is sometimes a lag where I can't scroll for a moment right after the page loads, but hard to say for sure. Still seems usable to me. |
Does this happen on master too, by chance? |
Okay! Taking another look at this 😁 Trying what I think is the latest build of this (59c43b440752d04852a6a86c) on my Android 8.0 phone:
I don't see any of the behavior described above on my device on master. I can also reproduce 2 and 3 on the Android simulator (but not 1, perhaps b'c the mouse is a different kind of input device...not sure). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing my review since Brian found Android 8.0 still has issues. That's frustrating. Maybe we can talk more in chat about which versions of Android we want to test and how to get them all tested/working before launch.
Ok - so I wonder if the difference between Brian and my test is the version of mobile Chrome we are running? Chrome 61 just came out, and had some breaking changes related to scrolling. We just fixed a bug in Draft.js related to this. @bvaughn what version of mobile chrome do you have on your Android phone? Mine is props to @sophiebits for talking through this and giving me the idea. |
Thanks for the reviews, folks. I'm closing this, as 1/ a rebase I did on this branch caused a regression in the scrolling, and 2/ it'll be easier if they're divided up into separate PR's anyway. 👍 |
@bvaughn