Skip to content

Improve scrolling for code blocks on phones #81

@cellio

Description

@cellio

https://meta.codidact.com/posts/287468

On a phone, a code block -- which is within a scrollable block -- can be taller than the screen, making it difficult to scroll the post and not the code within the post. Right now the height of the code block is a hard-coded number, and there is no single number that is going to be good for both desktops and phones.

Can we detect that we're on a small screen and set a different (still hard-coded) number? That's probably easiest.

Can we detect the height of the viewport and dynamically set a size that's no more than, say, 75% of the vertical space? That seems harder.

Can we add some sort of "collapse this code block" control (with the inverse "expand" of course), so you can temporarily dismiss a code block that's interfering with viewing the post? (Might be easier than the dynamic option.)

Is there some other way we can improve this? I don't spend a lot of time looking at code on my phone; are there conventions we should be following?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions