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

[Gatsby Docs Update] Fixed iOS overscroll issues, and redesigned mobile sidebar button to … #10761

Closed

Conversation

joecritch
Copy link
Contributor

@joecritch joecritch commented Sep 20, 2017

@bvaughn

@reactjs-bot
Copy link

reactjs-bot commented Sep 20, 2017

Deploy preview ready!

Built with commit 9beb61f

https://deploy-preview-10761--reactjs.netlify.com

Copy link
Contributor

@bvaughn bvaughn left a 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);
Copy link
Contributor

@bvaughn bvaughn Sep 20, 2017

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.

Copy link
Contributor

@flarnie flarnie Sep 20, 2017

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%)',
});
Copy link
Contributor

@bvaughn bvaughn Sep 20, 2017

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.)

@@ -25,11 +25,13 @@ const Flex = ({
shrink = 1,
type = 'div',
valign = 'flex-start',
className,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Alpha-sort props 😄

Copy link
Contributor

@flarnie flarnie left a 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.

@joecritch
Copy link
Contributor Author

joecritch commented Sep 20, 2017

@bvaughn @flarnie

  • Fixed the scrolling issue. It was actually the overflow-x: hidden on the article. I've fixed the horizontal scrolling with a better solution.
  • Agreed that the text truncation is a trade-off with the floating button. However, you do already have context of what page you're on, and I feel like it's better than a full-width button when being 44px further up.
  • Yeah, the global event handlers and CSS aren't ideal. Don't have the time to improve these tonight, so any help would be great.

@Mathspy
Copy link

Mathspy commented Sep 21, 2017

For the lack of a better place and for the sake of not to opening my first React PR to add a line:

This tiny little visual bug (the unneeded scroll bar) exists on Chrome 61, and it should be fixed with a little overflow-y: hidden
Tiny Little Bug

Loving the new website so far ❤️ ❤️ ❤️ Amazing work everyone!

@joecritch
Copy link
Contributor Author

@Mathspy Thank you! It's on the list 👍

@joecritch joecritch changed the title Fixed iOS overscroll issues, and redesigned mobile sidebar button to … [Gatsby Docs Update] Fixed iOS overscroll issues, and redesigned mobile sidebar button to … Sep 21, 2017
@joecritch joecritch force-pushed the gatsbyDocsSidebarIOSSafariFixes branch from 0fb9154 to 87cc5c5 Compare September 21, 2017 16:16
@@ -30,7 +30,7 @@ const sectionList = sectionListA
}),
);

const Docs = ({data, location}) => (
const Docs = ({data, location}) => console.log('render Docs') || (
Copy link
Contributor Author

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)

Copy link
Contributor

@flarnie flarnie left a comment

Choose a reason for hiding this comment

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

lgtm - I manually tested Firefox at various widths. Going to manually test Android, iOS, Chrome 61, and IE, but I think we can tackle any bugs with those as follow-up or separate work.

This is looking so slick!

seal_of_approval_again

@flarnie
Copy link
Contributor

flarnie commented Sep 22, 2017

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.

@bvaughn
Copy link
Contributor

bvaughn commented Sep 22, 2017

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?

@bvaughn
Copy link
Contributor

bvaughn commented Sep 22, 2017

Okay! Taking another look at this 😁

Trying what I think is the latest build of this (59c43b440752d04852a6a86c) on my Android 8.0 phone:

  1. The nav doesn't open when touched. Instead a Chrome pop expands from the bottom to show a link to more info about the tapped text (eg "Hello World"). If I'm careful and click on the arrows instead, this doesn't happen, but neither does the menu open. (Edit: Perhaps this could be fixable my styling this text to be non-selectable? eg user-select: none).
  2. The text truncation still happens too. eg on the Tutorial page, the nav just shows "Tutorial: Int...".
  3. The scroll-stuck behavior still blocks the first attempt to scroll in a new direction (as described previously).

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).

Copy link
Contributor

@flarnie flarnie left a 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.

@flarnie
Copy link
Contributor

flarnie commented Sep 22, 2017

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 60.0.3112.116.

props to @sophiebits for talking through this and giving me the idea.

@joecritch
Copy link
Contributor Author

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. 👍

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

Successfully merging this pull request may close these issues.

6 participants