392 points · by matser · 1y ago · 153 comments
It's an excellent article, and the work within is very well done, but there's a part of me that screams "Why would you introduce this much complexity for what should be a simple scroll?" (overcoming technical hurdles to produce the desired end result aside).
OP is doing a basic analysis on what kind of solutions exist for a typical UX edge-case. They even provide the simple solution that most people use (margin-bottom).
And for fun they go on to see if they can solve it without the minor drawback of the simple solution.
We've got to stop acting like it's a badge of honor to avoid UX consideration. We might not be people who implement UIs, we use UIs all day and should be able to muster up a few opinions about how a UX interaction should work.
UX is in the gutter with extra clicks and terrible workflows in almost every website. UI is a catastrophe of mobile first, but not really, but sort of kind of we want power users but we need regular users, and all our UI kits look like total ass that is incompatible with so many other things.
This website is a great example. The webpage doesn't load instantly and instead forces the user to wait for text to appear. Great UX engineering guys, make the user wait!
The entire web stack – backend and frontend – is a mess because the nature of the web is cumulative development over two decades, leading to a pile of abstractions upon abstractions that by some miracle remain mostly interoperable and backwards compatible.
What the mass user finds "intuitive" is already formed and it's in a horrible place and it's hard to go back.
Which is what I loved about this article - it demonstrates a sizeable effort resulting in a UI implementation that is just not much better than having callouts / figures in the text- and then admits it.
Building excellent user interfaces is hard, regardless of the technical stack. You have to sweat a lot of the finer details, break out of any platform default behaviour where appropriate, and over engineer something in service of building a 'delightful' user experience.
Or, you can do as most do, and just not do this. #anchor-links with `scroll-behavior: smooth;` CSS will get you the basic smooth scrolling.
From time to time I dip my toe in and try new things, but as productive as I can get with Astro, the illusion vanishes as soon as I have to understand any of the plumbing.
Fortunately, I can still party like it’s 1999 just fine: just yesterday, I worked on a janky brutalist web app (the same way I did back in 2002, cribbing from the O’Reilly “Dynamic HTML: the Definite Reference”) and “deployed” it with rsync to pico.sh. It’s practically unstyled and I didn’t even use jquery, but it works.
But frontend stuff is messy. How do you tell a person what they're trying to do is wrong and they need to change their inputs? Oh, maybe we can highlight the input or we can pop a modal message. Haha, psyche! Users ignore that shit! Now what you gonna do, buddy?
Frontend is a mess because all you people are a mess.
As a backend guy who considers himself extremely fortunate that nearly all of his users/customers are technical, this got an audible chuckle out of me.
That's like saying "You need user interaction? Here you go, here's a frontend."
For example, every Thunderbolt dock's internals are basically the same, while the outer shell tries to be as different as possible.
Before WWW was a thing we already had user interfaces and the fact that current users frequently prefer those ancient, text user interfaces over modern ones tells a real LOT.
Because the scroll, as you see, is not simple. The complexity of the real-world scenarios outlined in the post force the complexity of the solution. It may feel that "it's simple common sense" kind of thing, but if you ever tried to implement a simple common-sense thing, you know that it only appear simple.
By the same token, some UX person might read about the mechanics of database transactions with two-phase commits, or about MVCC, and ask why so much complexity exists around what should just be a simple write to disk.
"Reality has a surprising amount of detail."
I’m a passionate frontend engineer, but I do think we are often busy “asking if we could”, and ignore “if we should”.
Worth noticing, on mobile you can’t even read the conclusion in the “it’s beautiful” demo, because the navigation covers it.
I understand that it is just a demo, and that issue could be solved independently…
But I think it also points at the observation that when you try to do these kinds of unusual things, you open yourself to unintended consequences.
And while you can mitigate those consequences one by one, my experience is that you generally won’t have a chance nailing them all, unless you are also minimizing their number… by not getting too fancy.
You should be able to take a given UX and ask yourself if it can be improved.
A table of contents that tells you where you are on the page is useful.
Here's an implementation: https://getbootstrap.com/docs/5.3/components/modal/
On desktop, the table of contents on the right shows you which header you're on.
You are correct though that there are many cures worse than the disease, but it is a real "disease", so to speak.
Numerous autoplaying video methods for example especially when they follow the mouse, play in the background, or use lazy loading to be unkillable.
Speaking of lazy loading or whatever hundreds of variations probably exist around it now, the terrible front end devs of the world have decided to use that for everything. Everything is a sliding panel full of sliding panels and there’s no way to use browser back features coherently.
Scrolling down a site now loads a new site and destroys your history. Even if you scrolled to move content up because an autoplaying video anchored to the bottom of the screen is blocking the view. Scroll down too far causes a jump and the site decides you’re done and loads the next thing with no way to navigate back.
How do these developers have a job? How are features like this even invented with no critical thought or understanding of real world use cases questioned. It’s again and again and again that we see this.
And the Google team is so proud every time with their demo videos that is painfully obvious they put no thought into it outside of their bubble of them deciding some random thing was technically possible to do as a proof of concept and should therefore be immediately released as a fully supported feature.
Do you really think nobody asked for that? And maybe for something even more obnoxious than that?
(I use Firefox with uBlock Origin to preserve my sanity.)
Backend presents some awesome opportunities too, but I absolutely love weird problems like the one you're solving here. It's in the realm of simultaneously necessary and totally unnecessary. This is where interesting stuff happens!
The article explains the "why."
> overcoming technical hurdles to produce the desired end result
Yes.
I'm a hands-on CTO in a very small company. So, if it's technical, I'm doing it. Websites, apps, backends, databases, devops and all the rest. Not always fun. But at this point I can fill every role in a typical product team and do a decent job.
And I agree that what passes for state of the art on the web is a bit meh. Anchors date back to the early days of the web. One of those forgotten features that is still vaguely useful but a bit underused. There's a reason mobile developers prefer native UI toolkits. Browsers are a bit limited and backwards. CSS is a bit of a straight jacket. And Javascript is a bit of a basket case as a language.
Yeah, when you can't easily scroll anymore because it's "too far" then something has gone very, very wrong.
One answer I can think of: if a reader is in the middle of a long section, and the heading is off the screen, it can remind them which section they're in relative to the others.
This indicates (to me, anyway) that it's not a function of which heading you've scrolled to; it's a function of which section is on screen. If you use section-screen-area or something similar to highlight the active section, fiddling with the heading positions becomes unnecessary.
If you have a tiny section at the end that can never take up the majority of the screen, then when the user is reading it, the active indicator won't really be useful anyway.
Regarding the purported problem they solve, maybe browsers should have an option to show current-heading information, similar to how IDEs show in which function or the like you’re in within the current source file.
I would spend political capital not to hire this person.
Now I’m just waiting for scroll-timeline or scroll-state to hit GA so I can shrink stickied headers in pure CSS.
But this, this is similar, but different. I can't navigate to anchors with for example the keyboard.
Question for the author: Why not use the HTML <a> element rather than a JS event listener on a non-interactive element?
> But if you ever had to implement them, you might have encountered the .
Wikipedia is also bad about JS-dependent false anchor links. I can't count the number of times someone "linked" me an "anchor" to an image on a wikipedia article that simply did nothing without javascript. All wikipedia would have to do is put a real html a anchor next to the JS defined one to fix it but despite submitting bugs about this it's never been fixed.
I suppose the article author disclosed right away that it's "overegineered" so maybe the post is more of a joke or exercise in absurdity? Nobody would really spend time doing this for a real project, right? RIGHT?
Maybe a 90vh margin for mobile and 50vh for everything larger.
Hmm, then again you'd still need TFA's solution for the latter case. The margin only solves it on mobile since a 90vh margin on desktop would look ridiculous.
Examples: https://getbootstrap.com/, https://discord.com/, https://tailwindcss.com/
That way on desktop you could get away with a 50vh margin under the content and then another 50vh for the footer. That's free overscroll.
I use it every day instead of anchors to highlight very specific parts of the text, to avoid referring to the whole section with an anchor. Some pages don't even have anchors
Ref: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/F...
Cool post! It's refreshing to read a blog that doesn't ask me to subscribe with popups etc and gets into technical weeds
Im on the fence about pre-opening the 'tiles' on mobile. Do you (or anyone else) have any strong opinions on that?
Because I don't know what the drop off rate is when someone reads this, take what I say with lots of salt.
Giving one button as a demo and then saying click on button to close (and leaving it implicit that the rest of the buttons need to be opened manually) seems good? Leaving them closed by default worked great for me!
Off the top of my head, I'm not sure how else you'd visually communicate "this bit is interactive on click/hover but isn't a link." Maybe a different text color (without underline), background color, outline (replaced by the colored highlight bar on hover), or a slightly larger and more distinct icon to replace the generic 'image' icon?
I don't agree with either. Even after I enabled JS (no warning) and then after reading the whole page, finally realized that the implementation of popins was completely broken on Firefox and switched to Chrome to reread it (it doesn't help that the first 'link' is not a link†, and the link says it's 'broken' but it means broken in a different way from being actually broken so when you click on it and nothing happens, you infer that nothing was supposed to happen, which is why you were told it was broken...), I still couldn't understand WTF the problem was or how any of this could be remotely justified compared to an ordinary ToC and section headers or anchors.
† I'll just note that I have looked at many, many sidenote implementations (https://gwern.net/sidenotes) and the choice to make your sidenote/footnote link look exactly like a regular link is an... interesting choice.
If you have any feedback I'd love to hear it!
The links open in a window, so you can still have centre aligned text with popups.
did you consider pushing the word(s) directly following the activation button to below the detail pane, rather than doing it based on line break?
In fact the final solution is pretty bad. Sure, it looks nice when I scroll down, but when I use the alternative navigation method of clicking the sidebar items, it just scrolls to unexpected places.
Beautiful article, though.
I don’t think this is a real problem that needs solving; or I at least think it’s a problem browser vendors should solve, but lets over engineer it while still trying to keep it simple and usable…
What I might do is something similar to what you’re suggesting. I would have the anchor tag be a regular old anchor tag. Then, I’d highlight the heading (maybe just temporarily) at the same time. I’d use CSS if I could figure that out or JS if I couldn’t. The end result would send the user to the normal place and flash a highlight on the heading for users with JS support.
Keep it simple, but over engineer it to make whoever requested this happy.
Edit: After re-reading your response we probably aren’t talking about the same thing, exactly.
So you could have multiple items highlighted, but it still "works" somewhat intuitively for the end user.
The drawback is that it requires JS via intersection observer. But maybe the CSS standards committee could see value in this kind of thing eventually.
Surely the answer is to highlight all onscreen anchors. You don't know where my eyes are looking on a page with two headings on it.
It’s what headings maps extension does when you click on one [0].
[0]: https://addons.mozilla.org/en-US/firefox/addon/headingsmap/
Setting all moral arguments aside, it's important to know that similar phrases can work as dog-whistles to signal belonging to radical groups, and as such can easily give people the wrong impression about you as an author.
If I were to see a blog post titled "Work will set you free"[1] written by a peer, prospective employee/employer, colleague, etc., it would immediately set off alarm bells in my mind – even if the content of the post is a completely innocent discussion of the uplifting benefits of buckling down on one's workload. At best, it implies lack of awareness – at worst, it implies some extremely hateful beliefs and desires.
[1]: Written above the entrance to the Nazi concentration camps as a false promise encouraging prisoners often destined for death to work hard in forced labor.
[0] https://developer.mozilla.org/en-US/docs/Web/API/Intersectio... [1] https://github.com/keybittech/awayto-v3/blob/main/landing/la... [2] https://awayto.dev/docs/0.3.0/
To see what I mean, click "Creating a Feature" then start scrolling up. Notice that "Creating a Feature" is still highlighted even though the entire screen is made up of text from the "Software" section.
I probably only noticed this because I recently implemented a similar "active anchor" solution with Intersection Observer.
My solution was to just highlight the last anchor if the user scrolled to the very bottom. Although this might skip the second last heading if its too close to the bottom.
See here: https://sharezone.net/privacy-policy (most visible on desktop, on mobile you have to open the "Inhaltsverzeichnis" at the bottom)
Say that you find yourself needing to check the "Control code table" section of the Wikipedia ASCII article from time to time (for some reason). Being able to bookmark that specific section[1] is much more convenient than having to always start from the top of the page[2] and then scroll down (or click some on some anchor link) to get where you actually want to go.
This thirty-five website doesn't seem to offer that functionality because it doesn't use #anchor-name URLs.
On mobile just clicking the other blog post takes me to the end of that post. (Chrome iOS)
snake-y example: https://zquestclassic.com/releases/2.55.0/
On large screens I prefer to not read texts at the bottom (I always scroll things enough so I am looking at them at the middle or top of the screen). Also, the positioning of the heading relatively to the screen is always the same on every scroll.
Seems like if you open the "he thinks" image thing at the bottom, and then go back to the "beautiful" result, then it no longer works and the Conclusion heading doesn't get activated. That's how I reproduced it anyway.
Which might be an approach for the first few examples.
I am sure there are other cases that would need anchors.
I backed right out of whatever that was.