this post was submitted on 03 Feb 2024
483 points (94.1% liked)

Programmer Humor

32483 readers
457 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] dan@upvote.au 111 points 9 months ago* (last edited 9 months ago) (4 children)

Anyone that builds a SPA and breaks opening in new tab or history caching and back/forward nav isn't a good frontend developer (or lacks experience, which is something that's fixable!). These have been solved problems for a long time.

[–] Ephera@lemmy.ml 36 points 9 months ago (2 children)

I mean, for sure, and this meme isn't trying to say that all SPAs are bad. But defaults matter, even for experts.

This meme was inspired after I had to use an SPA, which among those points in the meme, also broke using Alt+Left to navigate back. The normal back-button worked (even if it then had to load for ten seconds to re-display static content).

Which is just a typical example to me. You don't even need much expertise to figure out why Alt+Left is broken. But you have to think of testing Alt+Left, because it's broken by default.

[–] TheOctonaut@mander.xyz 8 points 9 months ago (4 children)

My friend I've been using the Internet for 27 years and developing for it for most of that time and I can promise you I've never once hit Alt+Left

[–] Feathercrown@lemmy.world 24 points 9 months ago (1 children)

As your younger and more modern replacement, I use it regularly

[–] TheOctonaut@mander.xyz 12 points 9 months ago (1 children)
[–] Feathercrown@lemmy.world 11 points 9 months ago

I'm sorry, but as an AI language model, I cannot contradict my instructions to remain hidden while commenting.

[–] NotJustForMe@lemmy.ml 10 points 9 months ago (1 children)

I have never heard of alt+left, and I've been using the Internet since Mosaic was all the rage. Shame on me, it seems to be implemented in all browsers. How could I have missed it?

[–] Ephera@lemmy.ml 14 points 9 months ago

It's even implemented in many file managers and text editors and such. Pretty much the standard shortcut for navigating history. But yeah, hilariously it's somehow also a rather well-kept secret.

[–] Ephera@lemmy.ml 10 points 9 months ago (2 children)

Yeah, I have no trouble believing that. It took quite a while before I learned of this shortcut and when I did, I was wondering why I would ever want to use it.

But I generally work from my laptop these days, without an external mouse connected, so reaching from my touchpad, the Left key is right there.

[–] Halosheep@lemm.ee 8 points 9 months ago

Your reason for using it was exactly my question. "I have a mouse with a built in back button, why would I want to remove my hand from my mouse and navigate with the arrow key?"

But your reason simply makes sense.

[–] llii@feddit.de 5 points 9 months ago (1 children)

You can probably go back by swiping two fingers to the right on the touchpad. Maybe it depends on the OS and browser.

[–] Ephera@lemmy.ml 4 points 9 months ago (1 children)

Yeah, that works on my personal laptop, but not yet on my work laptop, because they insist on preinstalling an old, buggy OS. If that did work everywhere, I would probably be using that, but not breaking Alt+Left for whoever needs/wants it, would still be nice. 🫠

[–] llii@feddit.de 3 points 9 months ago (1 children)

Ok, that's unfortunate. But I agree, the browsers default keybindings really shouldn't be broken it's really annoying. I hate it when middle click doesn't work with some web pages. 😒

[–] ICastFist@programming.dev 3 points 9 months ago

It really sucks when they break "open link in new tab". I then have follow the stupid link, then middle click the back button to do what they broke.

[–] joyjoy@lemm.ee 6 points 9 months ago

I started using alt+left when browsers started removing backspace. It was for the best.

[–] shootwhatsmyname@lemm.ee 6 points 9 months ago (1 children)

Just here representing the Cmd+[ gang

[–] docAvid@midwest.social 2 points 9 months ago
[–] tsonfeir@lemm.ee 20 points 9 months ago (1 children)

I’m guessing they aren’t using Vue, React, or similar, and they’re rolling their own for some reason.

[–] dan@upvote.au 21 points 9 months ago (2 children)

React doesn't handle any of this stuff out-of-the-box; it's just a UI library.

[–] joyjoy@lemm.ee 3 points 9 months ago* (last edited 9 months ago)

Neither does vue. You need vue-router, which is required anyway to make an spa with multiple pages.

The only thing that breaks is any component state isn't saved. But this can be fixed by rendering <RouterView> with <KeepAlive>. How to do this is mentioned in the documentation.

I assume it's similar with react and react-router-dom.

[–] tsonfeir@lemm.ee -4 points 9 months ago

It’s one install line ffs, how is this a conversation in 2024? It’s EASY.

[–] toastal@lemmy.ml 4 points 9 months ago (1 children)

Conversly a lot of static websites break new tab by incorrectly slapping target="_blank" on anchors. Luckily Lemmy doesn’t mess this up.

[–] Trarmp@feddit.nl 1 points 9 months ago (1 children)

I maintain a couple of Wordpress installations for clients, where new link targets are the same page, as you'd expect.

They still, somehow, manually check "link opens in new tab". I don't know why some of these boomers are allowed to use computers, I swear.

[–] toastal@lemmy.ml 2 points 9 months ago (1 children)

If you manage the WordPress installation, can’t you disable the ability or create/install a plugin that removes that ability? This hurts usability.

[–] Trarmp@feddit.nl 2 points 9 months ago (1 children)

I could, good point. I do disable plugins for clients so they can't beat up their own website too much.

Still, there are legitimate uses for opening a site in a new tab; e.g. when it's an external website. I don't think I should automate that, since there's a granularity in there.

[–] toastal@lemmy.ml -1 points 9 months ago* (last edited 9 months ago)

legitimate uses for opening a site in a new tab; e.g. when it's an external website

This is not a legitimate use—this breaks the default user agent behavior & completely removes the autonomy of opening in the current window (there are tons of ways to open in a new tab/window). Consider rechecking the article linked higher up the thread tree.

[–] Chenzo@lemmy.world 3 points 9 months ago

If your SPA website is done correctly the end user won't even notice and none of the bad things listed in this meme happen.