393 points · by efunction · 8y ago · 260 comments
It's not all that hard to build a React or Angular apps that use proper links along with the browser history API. Designed properly, the apps should be able to load their state and render correctly even when deep-linked to somewhere other than the app's top level.
This isn't a new concern - I remember paying attention to this back in the old days of SPAs using GWT back in 2009/2010.
Unfortunately, many web apps choose to ignore this. On the bright side, lots of them get it right, too.
I haven't checked in a while, I wonder if this situation improved? A lot of these frameworks market themselves as dead easy, but I always found a gap between the "dead easy start-up" documentation, and the documentation that essentially amounted to "read the source code."
I wouldn't be surprised if most if not all tutorials ignore it as well.
Humble suggestion: design fads.
My own question would be whether this gets taught anywhere. Because if it does, a few someones need to get fired.
My problem is usually the opposite: I constantly stumble upon websites that use ridiculously large fonts like I'm a grandma that tries to read something on an overkillishly-retina display from meters away. However it doesn't usually bother me when I'm browsing from my desktop 'cause I have options to zoom out; however most of mobile layouts feature something like <meta name="viewport" content="..., minimum-scale=1"> (edit: also mentioned in the article albeit in a bit different context), which makes me choose between intensive vertical scrolling in regular mode and constant horizontal scrolling if I "request desktop site". (Yeah, I know, "reader mode"; it's a reasonable hack but I'm not quite satisfied with any of implementations either, and it only works for whatever browser thinks the main body of the page is.)
Is this everyone else's experience? How has web design been taught lately?
Just don't.
PubMed.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3968624/
(There's still a legacy fallback.)
There are two choices: don't recreate the state -> people will call each other stupid over the phone because they see different things for the same link,
-or-
Recreate the state -> more money, more time,
-or-
Just don't have links at all. Which is what people usually choose because is faster and cheaper.
What changed was that before, "to do the right thing", i.e. have real links, was the easiest and the cheapest. Now to do the same, you need real developers. Even in Angular there is/was a discussion of where to put the state of the app in the url? put it in the path part of in the hash part? the difference being that the hash is not sent to server. So for search engines all those links are just one actually... Which is ironic because Angular is made by a search engine.
To track clicks.
How do screen readers handle these script-based links? I don't mind it from a "I have working eyes and arms" perspective, but I imagine it's kind of a pain for assisted vision?
I've no idea what people expect right clicking a delete link to open in a new tab to do?
I expect it to issue the delete, and then dump the response to the delete into a new tab rather than navigating away from the page that hosts the delete link.
There might be ten other delete links on the original page, and I don't want to delete-back-delete-back-delete-back, when I can just open all of them in a new tab, then go through the tabs to look for errors.
When you get sick of faking it you look into why there is no way to get browser to send real DELETEs and PUTs and w3c verbiage says "because application developers don't seem to need it" ... because they fake it ... because they have to fake it ... because browser don't do it ... because devs don't need it ...
Really egregious examples even change the location so that I can copy the URL after clicking, new tab, paste, and hit back in the original, but I can't middle click for a new tab.
But in cases where its behaviour is that of a button (even a button which has the appearance of blue text - think iOS) then onclick is a good choice. Especially for contexts where “open in new tab” makes no sense.
I can’t see any valid reason for using a void link - worst of both worlds?
Seen people make mistakes like this before... Even using a POST when it should be a GET can cause funny behavior. Funny, but not dangerous behavior like using GET instead of POST.
Whenever I bring a new web dev aboard this is my first lesson to them, and I say "all sorts of clients are going to crawl your webapp, so make sure your webapp is coded correctly for it." Browsers are coded with this assumption, bots/crawlers, email clients, etc...
http://blog.moertel.com/posts/2005-10-25-google-web-accelera...
I’d rather style the thing to look the way it should rather than apply unusual functionality to something.
Maybe we should investigate this ancient tech of the old ones.
Use a separate CSS via link tag? Oh no, I heard that was slow. Set expires cache header for 1 day? Oh no, that makes testing hard for me and what if the CSS changes?
Web developers sometimes use the dumbest reasons to avoid doing good things.
And probably accessibility tools for the blind.
pastebin.com/6Q8WT9WJ
For chrome there is a switche at settings > accessibility > show simpified view
When it comes to reading text I honestly prefer the old school academic websites (albeit with a max-width set).
Keeping stuff simple even makes maintaining the site simple, I personally run https://www.discoverdev.io and have used zero JavaScript. Inspired by brutalist design principles :)
79.2KB to load home page
sub-second load
7 total requests
In contrast... where I work, to load our enterprise webapp's home page (running on Angular, WebAPI, many external CSS/JS "plugins"):
5.7MB to load home page
28.95s to load everything
173 total requests
Granted we're serving a way different goal, but still... i admire how lightweight your site is.
It's the same reason why divs won in the first place. You can't dictate the shape of a document to people and it be anything other than a kludge.
Take the site I work on, Great Big Story[1]. We have sections and headers, but our content isn't defined by text, it's defined by graphics and videos, with little metadata sections on the video player page that I suppose could be semantic if we had the right descriptive tags. I use semantic markup when it seems to make sense, but we have so many weird little needs to introduce elements just for styling purposes.
Take a recent example, I need four elements to make a styled file input form. Two labels, one to look like a button and can be clicked, taking advantage of the browser behavior of treating clicks on the label to be clicks on the form. The other label is the actual label, could be just a span if I wanted, it doesn't have the htmlFor attribute set. The actual form input button is hidden using CSS tricks because the actual button can't be styled. Finally there's the filename display, which is set to the filename of whatever was uploaded or the existing one if present. This uses Javascript callbacks to get set.
None of these elements are semantic, legacy cruft keeps the markup from being simple and readable. I suppose you could demand our video presentation site to be a motherfucking website[2], but I fail to see how that will actually improve much of anything and would just hurt our brand. I'm getting a little tired of coder hatred for web fashion. It keeps us all employed.
But I think we're at least 10 years out from being able to actually use semantic markup. Web standards and browser vendors still have some maturing to do.
In a good model of the web, html is your data, css is your styling, and javascript doesn't really exist.
In another model of the web, your data would be your data, html/css would work together to form a scene-graph. Javascript defines the relationship between your data and it's scene graph.
That friction, are we using html as data or as part of our scene-graph, is what causes a lot of these problems.
I tried to make an argument on a React community slack that components are purely visual, that they should express the visual structure of the web page, in the context of an argument over how state and props should be used.
He hated the rise of the Redux ecosystem, and I was trying to make the point that if you don't manage global state in your application sanely, you'll only end up reinventing it poorly, passing onChange across the Atlantic in the case where your save button doesn't live in the same visual space as the rest of your form.
His response was to bring up the Router component to make the point that not all components are visual.
UIs are complicated things, I've found that the visual model is the best encapsulation concept. Components aren't bad, but you need to first have a need to use them, because there's definitely a tradeoff, and second you need to use the right abstraction techniques. Routing components are a hack, different pages should just load different base components in the site backend.
But it seems like once someone swallows the functional paradigmatic koolaid, they lose all perspective to see when the paradigm fails to produce erudite design.
Buttons can be styled.
let i = document.createElement('input');
i.type = 'file';
// other attributes if you like
i.onselect = ev => {
// ev.files contains selected files
};
i.click();
i.remove();
No stupid styling hacks needed. At most you may need tabIndex on the <a> or <div> that represents the button for selecting files.You can leave <input type=file> around if you want to submit data via <form> and not via XHR.
I think this is the number one reason why I prefer mobile dev over front-end web dev.
I've ranted about this before, but worse is that everyone insists on trying to go with the default flow of elements as much as they can. Example I used last time was that it is actually easy to layout things and have them look pretty solid between browsers, iff you embrace absolute positioning. http://taeric.github.io/cube-permutations-1.html is a page where I played with laying out a Rubik's cube. I confess I have not tried it in all browsers, as I don't care too much, but it works in all of my browsers, including my phone. I shudder to think how I could have done that with just using floats and inline-block style concerns.
Why do I claim that makes it worse? Because you wind up with more markup just to trick the layout engine to calculate where to put things. Instead of you just figuring it out largely on your own and not building a Rube Goldberg machine to layout a page.
Internally for a previous company, I did this only to have the next person try to get rid of absolute positioning because "gross". Over two sprints later they caved and went back to the working solution that was a) less code, b) worked everywhere, and c) was easy to modify by virtue of a.
I suspect if I performed the same test in my 1440p 27" monitor, I'd have a surprisingly similar problem, of overly small text in a small box in the centre.
So in reality, while it may have made it super simple to preserve the shape of the Rubik's cube unfolded, it's impeded reading the main content on anything outside the range of a plus side phone to a Macbook's scaled 1440x900 canvas. And really the Rubik's cube could have been just a image (an SVG if you're worried about sharp or selectable text).
Note, I couldn't just do an image because of the animation nonsense I was playing with.
Edit: though, oddly, I think you are really complaining about some of the styling I inherited from org. I can possibly fix that easily enough. Never tried. Pretty sure I can just swap out a "width" with "max-width" and things will reflow as desired. For my eyes on my phone, the current width was fine. I didn't bother checking why it killed reflow. But I can confirm it reflows as desired on desktop if I do that.
Flex and grid are more intuitive so they're easier for juniors to train up on.
Not to say that they can't do better with flex and grid. But it was like our entire industry didn't even bother trying to learn with the first tools that our industry made.
> <img src=“https://example.com/image.png” alt=“developer in an office working feverishly to hit a deadline on a software project” />
Is this actually a good idea?
This sounds like a typical "hero" or "teaser" image, to capture the reader's attention or interest. I don't think the alt tag does that in a comparable way, for a screen reader for example. So I'd just leave it blank.
It's really frustrating: all articles on accessibility mention the alt attribute, and that you should use them. But few give guidelines on how to write a good alt attribute that is actually well thought out.
When I write a website that explains things, and uses images, I (nearly) never use only images, but usually images + text. If I put an alt description in the images, I basically duplicate the text, and I guess that will confuse screen reader users more than a blank alt text.
Am I totally off base here?
The only practical difference is that with alt text, the blind person is aware that there's a graphic on the page. With alt="" they have no idea the image exists. Does that matter? Maybe in some contexts - you have to use your best judgment on a case-by-case basis.
It also doesn't require alt text for images that are purely decorative and not necessary to understand the content, though this is a bit subjective. Could a blind reader still imagine the idea of a developer in an office working feverishly to hit a deadline, and would that add to their experience of the article enough to be worth including? Again, there are no hard and fast rules here so you just have to use your best judgment.
Just kidding of course. I always put blank alt attributes on images that are used purely for decoration, and nobody has complained.
You're not alone in feeling this frustration. In fact, this very article includes what I presume to be a screenshot of some code from the React docs. I have to presume that's what it is, because I'm a screen reader user and they haven't provided an alternative, screen reader-accessible version. Go figure.
> An image on a Web site depicts the floor plan of a building. The image is an image map with each room an interactive map area. The alt text is "The building's floor plan. Select a room for more information about the purpose or content of the room." The instruction to "select a room" indicates that the image is interactive.
And how does it help any blind person to know that there is a building plan, but none of the contents of the building plan are described?
Or am I misunderstanding the purpose of the ALT text?
That assumption is that the rooms are selectable, so "tabbing" with a screen reader will select each and speak their Alt text.
I know it’s hard enough to get consistent support for "alt" at all but an "alt-long" might be nice too so you can say things like alt="Picture of ocean landscape" alt-long="An evening shot of a beach in the Maldives, with a full moon, no clouds and still water.".
Thankfully, my eyesight works. But I’m sick and tired of designers pretending I’m illiterate and replacing text labels with inscruitable icons and graphics. Hey, remember when you could change your preferences by going to “File -> Preferences?” Instead of hunting around the interface looking for an unlabeled gear icon or hamburger icon or whatever some designer thinks conveys the same concept?
I also loathe the unnecessary javascript everywhere.
uMatrix has prevented the following page from loading:
https://blog.logrocket.com/the-easiest-way-to-keep-your-web-apps-accessible-c2b57506cc2a
I never blacklisted the website on uMatrix[0] myself so I checked the list of hosts files I'm using. It's apparently part of Peter Lowe’s Ad and Tracking Server List[1][0] Obligatory "How do you know someone uses uMatrix? They'll tell you"-joke. I know, I know... mea culpa
[1] https://pgl.yoyo.org/adservers/, https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hos...
* https://www.reddit.com/r/YouShouldKnow/comments/97an7p/ysk_r...
They also describe their service:
> LogRocket lets you replay what users do on your site
ie, they track everything you do when you visit a site using their service.
I've updated the entry to just block this instead:
logs.logrocket.com
If you update your filter lists, you should be able to get to https://blog.logrocket.com/.I did a quick Google search on them, It's kinda ironic
>LogRocket helps you understand problems affecting your users, so that you can get back to building great software.
Skimming? Since when does a literate person skim? Just read it, you lazy so-and-so, like you just read a book! A book with gigantic margins, like all books ever!
/s
In the past decade designers/PMs have started to figure out that users don't read, so they aren't trying to wedge as much text in. Though I'm no fan of some iOS interface, I credit Apple with getting the concept of legible text into mainstream design thought.
As far as Medium et al goes - I think the idea there is not so much the font size as not wanting to show you more than 2-3 paragraphs, lest you get a "wall of text" opinion and not read any of it.
The irony is that people go to medium because it's kind of .. expected somehow? And looks more authoritative?
I'm honestly curious how Medium is an improvement over that. Are you referring to the technical challenges of hosting content, perhaps?
after 2000, graphic designers took over this work and evolved into "frontend" developers. although there were periodic wins like google maps that would have never been produced by the 90s greybeards...most of it has been an endless stream of garbage. but the goatee crowd should not bear all the the blame, some must also fall on the adtech people who insist I need 15 mb of tracking garbage to read a news story.
Matt Gemmell, from aa few years back:
https://mattgemmell.com/staying-creative/
Matthew Graybosch
https://www.matthewgraybosch.com/starbreaker/
Mark Pilgrim's Dive Into HTML5 is a classic.
http://diveinto.html5doctor.com
Outline is a lifesaver: https://outline.com
(Especially for browsers/platforms w/o Reader Mode.)
I've also got an entry in the motherlovin' website contest.
But if you have to do it in a browsers then at least make it so the actual content (text/images) do not require JS to load and display.
https://en.m.wikipedia.org/wiki/National_Federation_of_the_B....
https://en.m.wikipedia.org/wiki/National_Federation_of_the_B....
In my opinion, those call to actions are helpful when in the similar context with the content itself, or when placed outside of the content. Otherwise they are just intrusive.
1) Just use text
2) Make all your graphics into an otf font
3) Use CSS to style everything including backgrounds
The ONLY place you may need graphics is user submitted content like profile photos.
https://blog.bugsnag.com/bug-day-race-condition-therac-25/
I really wish "reading mode" was a prominent feature in desktop browsers.
font-family: sans-serif;
That is all neede in 2018, it even looks "native".What do you mean here by "prominent"?
Currently, I can only enable reader mode after my browser has loaded all the shit I don’t want loaded.
I tend to prefer leaving it up to their browser default when possible, on the assumption that the few people who really care have customized their browser and don't want me to override it and nobody else will appreciate my refined sensibilities in font selection.
By "desktop browsers", do you just mean Chrome?
Yes, I am using Chrome on Windows. Thank you for the Firefox suggestion! I didn't realize it was built in now and you can use a serif font. I guess it's back to Firefox!
An official keyboard shortcut for going to reader mode.
The option of having the browser send all articles to reader mode when detected as possible.
https://news.ycombinator.com/item?id=17721496
Blogs are such a waste. I dont need to hear your life story and opinions. Post the situation, the plan, and details/documentation.
I do not have the time to read a literal 6,000 words.
I for one, do enjoy reading a long article and if I'm busy I will bookmark it/add to reading list for later. Everything doesn't need to be crammed into 280 characters or less. Maybe I'm just old fashioned and should embrace our race to the future presented in the movie Idiocracy?