Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Since Apple have removed the vertical scrollbar unless the user is actually scrolling, I occasionally find myself checking whether there is more code at the end of a <pre> tag.

Is there are a way of showing that there is more code to scroll through?

I found this snippet of CSS:

::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 7px;
::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(0,0,0,.5);
    -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
share|improve this question
This, on any site, and including horizontal scrollbars and including vertical scrollbars on regular pages (not just in some embedded block that might need scrollbars), is the exact reason why I have my Mac simply always show the scrollbar. In other words: I doubt fixing on Stack Exchange actually fixes the problem? (Enabling that option reveals the scroll bars for SE code blocks whenever needed. So, "always" kind of implies "always, when scrolling is possible".) – Arjan May 20 '12 at 13:32
I prefer to hide scrollbars on the page as a whole, but they should always be displayed on scrollable blocks. I agree with @Arjan that this should be the operation system or browser's responsibility, but their defaults are dumb. I'd like a fix. Here's a user script that will display scroll bars when neccessary on Stack Exchange code blocks, but nowhere else, using my tweaked version of the above CSS. It's a bit off when two scrollbars are displayed, but otherwise looks good. – Jeremy Banks May 20 '12 at 18:28
up vote 6 down vote accepted

At first blush, I wanted to give this suggestion a +10. But then I realized that was my own bias talking, rather than a decision stemming from an objective assessment of the situation.

I think Apple's decision to hide the scrollbars by default was a terrible, horrible decision from a UX perspective. It's perfectly reasonable on screens with really limited real estate like an iOS device, but it makes absolutely no sense on the Mac where screens are getting nothing but larger. I haven't upgraded my notebook to Lion yet (still using Snow Leopard because I need Rosetta), but when I do, I'll certainly be disabling that "feature" once and for all.

But therein lies the rub… This is a preference that can be configured in the operating system for a reason: because some people like to have their scrollbars hidden (for some inexplicable reason) and other people don't. Sure, you and I and other rational people fall squarely into the latter category, but that doesn't give us the right to impose our preferences on others. If a user has configured their operating system not to display scrollbars, then the Stack Exchange CSS should respect those preferences, rather than try to override them.

As I see it, the worst case scenario is when you have three different options. Instead of just showing or not showing scrollbars, you can now have scrollbars shown on Stack Exchange sites in the code blocks and hidden everywhere else? Objectively speaking, that's even more confusing and broken.

So my verdict is a no. This suggestion breaks the cardinal rule: always respect the user's preferences.

However, an alternate solution comes to mind. Rather than forcing the scrollbar to be persistently shown, we could solve the problem of ambiguity in a different way.

The issue, as you point out, is that it's not always clear if there is more code to be displayed than will fit inside of the code block in the case where scrollbars are not being shown. We could fix this by adding a different sort of visual cue to the code well.

For example, if there's additional code that won't fit, a bevel or shadow could be added to the bottom (or top) of the code well, suggesting that there's more there to be seen if you scroll down. This gives us the visual affordance we want, without overriding the user's preferences.

But I have no idea if this is even possible from a technical perspective.

share|improve this answer
Good point, well made. The optimum solution, I guess, is to make it obvious that there is more content by displaying the top half of the last line. This seems to be the current design anyway. – Blowski May 21 '12 at 10:17
If there anything rational in preferring a setting to another one? – kiamlaluno May 21 '12 at 11:27
@kiamlaluno: Yes, you are clearly irrational if you have an irrational abhorrence for scrollbars. – Cody Gray May 21 '12 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .