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

doc: html of api doesn't allow scrolling past larger code blocks on mobile safari #5861

Closed
eljefedelrodeodeljefe opened this issue Mar 23, 2016 · 16 comments
Labels
doc Issues and PRs related to the documentations.

Comments

@eljefedelrodeodeljefe
Copy link
Contributor

  • Subsystem: doc

users on iPhones cannot scroll past larger code blocks. It looks like a redrawing issue, since browser likely knows the correct size of the whole page.

In the screen that you see me trying to moving up or down, white not having a scroll handle outside of the code block any more

ref nodejs/docs#92 (closes nodejs/docs#92)

img_0268

@mscdex mscdex added the doc Issues and PRs related to the documentations. label Mar 23, 2016
@jasnell
Copy link
Member

jasnell commented Mar 23, 2016

@nodejs/documentation @nodejs/website

@silverwind
Copy link
Contributor

I don't have an IOS device to test, but the only thing I can think of is removing this seemingly unneccessary overflow-x: auto;.

Edit: nope that'd cause the text to flow outside the pre.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

@silverwind it makes the text go outside the pre, but it fixes the issue on my iPhone.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

Adding

* {
  -webkit-overflow-scrolling: touch;
}

seems to fix the issue.

@kahwee
Copy link

kahwee commented Mar 23, 2016

Would it be better if we set a max-height?

pre.sh_sourceCode {
  max-height: 400px;
}

That way it lets the user still navigate the page can panning out of the code.

We can target this to the smaller screen resolutions.

@silverwind
Copy link
Contributor

So, if I understand correctly, the issue is that the pre's allow horizontal scrolling, while we want the page to scroll vertically. The problem doesn't manifest on Android Chrome because it scales down the font size of the code boxes to the point where no horizontal scrolling is needed.

It's probably worth investigating if and how http://devdocs.io/node/ solves this issue.

@silverwind
Copy link
Contributor

I think white-space: pre-wrap and overflow: auto might just be the solution. While it obviously breaks the visual code layout, I think it's a good compromise. Here's devdocs on a small viewport:

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

@silverwind I'm gonna try that.

@kahwee
Copy link

kahwee commented Mar 23, 2016

I think wrapping pre is a good compromise indeed.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

I think white-space: pre-wrap might just be the solution.

It works.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

Momentum scrolling gives a better scrolling experience though :)

@silverwind
Copy link
Contributor

Momentum scrolling gives a better scrolling experience though :)

But isn't it just a hack for this issue? I think having readable (and wrapped) code on Android would be nice to have anyways, in contrast to this:

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

@silverwind it is, but now that I've tried both with and without momentum scrolling I can say that it's a lot better with it on.

I don't know if http://devdocs.io has momentum scrolling enabled but their scrolling works better than ours with white-space: pre-wrap on pre tags.

Anyway I don't mind, I'm fine with using white-space: pre-wrap. It seems the correct way to fix this.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

I would say let's use both momentum scrolling and pre-wrap but the use of -webkit-overflow-scrolling is discouraged so forget about that.

@silverwind
Copy link
Contributor

Go for it. It's a big improvement to Android too in terms of readability. If momentum-scrolling causes no side-effects, it's probably fine. I think it has been suggested before too.

Some other related suggestions:

  • word-break: break-all on pre to fix a layout overflow (seen in process).
  • Maybe decrease the font size for pre on small viewports a notch.
  • Investigate why the section # is so tiny, at least on Android.

Here's Android with white-space: pre-wrap:

@lpinca
Copy link
Member

lpinca commented Mar 23, 2016

@silverwind the pound sign (#) is very small also on the iPhone, I will investigate as soon as I can get back to my MacBook.

lpinca added a commit to lpinca/node that referenced this issue Mar 31, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices.

Fixes: nodejs#5861
PR-URL: nodejs#5878
MylesBorins pushed a commit that referenced this issue Apr 11, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices. Also fixes a few minor styling issues that
came up in the discussion.

Fixes: #5861
PR-URL: #5878
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
MylesBorins pushed a commit that referenced this issue Apr 19, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices. Also fixes a few minor styling issues that
came up in the discussion.

Fixes: #5861
PR-URL: #5878
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
MylesBorins pushed a commit that referenced this issue Apr 20, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices. Also fixes a few minor styling issues that
came up in the discussion.

Fixes: #5861
PR-URL: #5878
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
MylesBorins pushed a commit that referenced this issue Apr 20, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices. Also fixes a few minor styling issues that
came up in the discussion.

Fixes: #5861
PR-URL: #5878
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
Fixes an issue that prevented scrolling from going past large code
blocks on iOS devices. Also fixes a few minor styling issues that
came up in the discussion.

Fixes: #5861
PR-URL: #5878
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations.
Projects
None yet
Development

No branches or pull requests

6 participants