DEV Community

Ben Halpern Subscriber for The DEV Team

Posted on

What would your opinion be of a "reading position" indicator on DEV?

We have this open PR and I'd love to hear opinions on the value of a feature like this:

Reading position indicator #1626

Is your feature request related to a problem? This is not a problem but I find nice that you have this bar that tells you the amount of scroll left until the end of the article.

Describe the solution you'd like My solution is to add a progress bar inside the #top-bar in nav and depending in the current position of the scroll it will change the percentage of this progress bar. The idea will be also that the bar color is the same as the user profile color, in my case dark green.

How to see an example? (GIF at the bottom) I created this code snippet that you can add in the Chrome Dev Tools > Sources > Snippets, and execute it with Ctrl+Enter (at least in Linux), be aware that you need to be in a post/article page for this to work.

const addProgressBarCSS = () => {
  let css = document.createElement('style');
  css.type = 'text/css';
  css.innerHTML = `
    progress::-webkit-progress-bar {
      background-color: transparent;
    }

    progress::-webkit-progress-value {
      background-color: #0D4D4B;
    }

    progress::-moz-progress-bar {
      background-color: #0D4D4B;
    }
  `;
  document.querySelector("head").appendChild(css);
}

addProgressBarCSS()

let topBar = document.querySelector("#top-bar")
let articleElement = document.querySelector("article");

let readingBarElement = document.createElement("progress");
readingBarElement.id = "reading-bar";
readingBarElement.setAttribute("style", `
    width: 100%;
    position: absolute;
    height: 5px;
    top: 49px;
    bottom: 20px;
    left: 0;
    right: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    background-color: transparent;
    color: #0D4D4B;
`);
readingBarElement.setAttribute("value", pageYOffset);
readingBarElement.setAttribute("max", articleElement.getBoundingClientRect().height);

topBar.appendChild(readingBarElement);

window.addEventListener('scroll', () => {
    let currentScrollPosition = pageYOffset;
    let readingBar = document.querySelector("#reading-bar");
    let article = document.querySelector("article");
    let articlePositions = article.getBoundingClientRect();
    let start = articlePositions.y;
    let end = articlePositions.height;

    if (currentScrollPosition >= end) {
        readingBar.value = end;
    } else if (currentScrollPosition > start) {
        readingBar.value = currentScrollPosition;
    } else {
        readingBar.value = 0;
    }
});
Enter fullscreen mode Exit fullscreen mode

Screenshot andd GIF explanation Gif link

image

This is the example:

My only technical concern here would be ensuring it doesn't add jankiness to the scrolling behavior, but otherwise this is more of a UX discussion.

Feel free to weigh in.

Top comments (48)

Collapse
 
cjbrooks12 profile image
Casey Brooks

I usually find them unnecessary at best, and distracting at worst. Having the "reading time" listed at the top of the article here is enough to give me a sense of how long the article is. But some people really like having them, so maybe there could be a setting for users to turn it on/off per their personal preferences?

I think the reason I don't care for a generic progress bar is that it doesn't really give me meaningful information about my reading progress. I might be halfway through the text of an article, but how much of the remaining article is code snippets, interactive examples, videos, prose, conclusion, etc? The actual progress of me getting through the article may be massively skewed by things that aren't raw text, and so it tends to feel quite arbitrary, generally-speaking.

A better measure of progress might be to enumerate the Headers in the article content, and highlight progress by which headers I've passed. A good example of this is the right-side menu of the Android docs. Seeing that I've got 2 content sections, an example, and a conclusion left until I finish the article is much more meaningful than some arbitrary measure of text. In addition, it allows me to skip directly to a specific section on the page.

Collapse
 
dmfay profile image
Dian Fay

Tables of contents would be good, but depend on authors getting their headings in order.

What about using a round "pie chart" indicator on the left sidebar, under the "bookmark" button? I know I've seen this sort of thing before but can't recall exactly where. I think that'd be less obtrusive than the bar across the top.

Collapse
 
terabytetiger profile image
Tyler V. (he/him)

I could see this being implemented with/near the ❤️/🦄/🔖 icons

Thread Thread
 
areahints profile image
Areahints

how did you get those icons to show up? I need the sauce

Thread Thread
 
terabytetiger profile image
Tyler V. (he/him)

On Windows, the emoji keyboard (win + ;)

Collapse
 
ryandotfurrer profile image
Ryan Furrer

I think this is a great way to do it as well is what I was going to recommend. On longer posts I find myself looking for some sort of indicator of where I am and this would be perfect.

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

I actually think it would be a good idea. Everyone is mentioning that they "just use the scrollbar", but there's one major problem with that: Right now, with the comments section, the bottom of the article is only 1/4 of the way down!

There are a lot of times that I want to know roughly where I am in the article. It's a side effect of my ongoing focus issues. When I start feeling burned out, I have to decide if I'm going to keep reading. I can scroll down to see "how much farther", but I risk losing my position, and I may not remember anyway! Times like that, I just stop reading.

Based on all that, I have another hypothesis: would such a feature reduce skimming?

Collapse
 
jeddevs profile image
Theo • Edited

My personel issue with it is it makes me want to finish quicker when im no where near the end or even close to the end while without it I sucker it up and find it less distracting.

But I can see how people like it, and maybe my reason isn't very common so if it is implemented i'd much prefer it be optional as it ruins my reading experience.

Collapse
 
codemouse92 profile image
Jason C. McDonald

"Optional" seems like the best approach to me!

Thread Thread
 
jeddevs profile image
Theo • Edited

After having read a fair amount of the comments I agree. Disabled as default, especially after having read the "busy but unclutured" reply. 👍

Collapse
 
moopet profile image
Ben Sinclair

Also some people are stuck using operating systems that hide the scrollbar.

Collapse
 
darksmile92 profile image
Robin Kretzschmar

I don't want this feature myself, but after reading some comments here I can see benefits to others.

I'd merge the PR and make it configurable through the user settings.
The default setting should be disabled.

Collapse
 
hkly profile image
hkly • Edited

I think it would be good for general accessibility, especially for the longer articles. It would be useful to have for folks who may need it for various reasons, including folks who have reading disabilities where it would be helpful to know how far they are into the article (the scroll bar only shows how far they are into the page, not the article), while not being intrusive and doesn't take away focus from the content for those who may not need it.

Edit: I'm a little surprised that most people are coming at this solely from a personal perspective vs a developer perspective. From an accessibility standpoint, this feature could be helpful for a lot of people.

Collapse
 
brianemilius profile image
Brian Emilius

So much this. I work with people who have dyslexia, and I've taught language professionally. One important experience I made was that people who are in some way "reading-impaired" need(!) an overview. They need to be able to comprehend the scope of the text they're reading, and they cannot do it the way a practiced reader can.

Collapse
 
missamarakay profile image
Amara Graham

I usually scroll up and down to see the scrollbar as an indicator, but I only do this in longer tutorials. Usually the reading time calculation at the top is enough for me.

I share your technical concern though, but if it can be added quietly and remain unobtrusive I wouldn't mind its existence.

Collapse
 
charlesdlandau profile image
Charles Landau

I don't think this should be turned on by default. Hear me out:

An example of this feature really working is spaCy, in my opinion. spaCy is displacing NLTK to some extent, so compare their website: NLTK

For spaCy.io all the design choices in their website hint at their modernity. It feels like a subtle way of doing the bit from the old spice commercial

That works for spaCy to help convince you: "we are the new hot stuff. We do the sexy. Look how slick our site is. It has all the bells and whistles."

dev.to needs none of that. When you first come here it feels busy but uncluttered. It has everything you want a modern blog platform to have. It feels like it's for devs.

"Busy but uncluttered" is hard to do. I feel like adding this feature would unnecessarily risk that asset.

Disclaimer: I'm no design expert.

Collapse
 
jeddevs profile image
Theo

👌🏻

Collapse
 
johnbwoodruff profile image
John Woodruff

I'm done with it so long as there's a setting to disable it. On a note of personal preference, the indicator as mocked up in the article, I often confuse these with loading bars. So it should be thoughtfully designed so as not to confuse users. With those points in mind I'm all for it if it helps people.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Really distracting and that is part due the horizontal vertical disjointed feeling.

Alternative idea: liquid tags that 'chapterize' a post, an author could decide to tag significant parts of the post to relay progress. Kinda like waypoints, then something in the UI could change. To relay that importantness.

Something like:

{% progres(0) #intro %}
This is a really long article on tabs vs spaces ...

{% progress(45) #chapter 56 %}
... And that is why it's really important. 

{% progress(100) #conclusion %}
... so please use tabs okay.
Collapse
 
dansilcox profile image
Dan Silcox

Not necessary IMHO, unless it’s in conjunction with an audio screen reader - this comes in super useful in, for example, my bible app which I use every day - I find it really useful to be able to read along while the audio plays.

Collapse
 
xowap profile image
Rémy 🤖

On the technical point of view I don't think it's going to be any issue (there's already something with a fixed position on the page and reading the scroll position is really lightweight).

On the functional side, well... Whatever the fuck I don't care (but I use Linux which still has scrollbars so maybe there's that?)