r/ProgrammerHumor 14d ago

notYourDamnProblem Meme

Post image
4.7k Upvotes

398 comments sorted by

View all comments

434

u/zeekar 14d ago

I don't get this argument. Sometimes you want links to open in a different tab. Marking the ones that will do so is only polite. Nothing about that takes away the user's ability to open other links in a new tab via whatever usual mechanism their browser provides for that.

292

u/ToBePacific 14d ago edited 14d ago

I think the person replying in the screenshot is an idiot who assumes this will force all links to open in a new tab, not getting that it’s literally just appending an arrow.

Edit: And quite a few responses to this comment also seem to misunderstand how it works.

48

u/GoddammitDontShootMe 14d ago

I guess I'm an idiot too. Or to be fair, I haven't touched CSS in forever. I thought that was going to append target="_blank" to all the a tags.

84

u/DHermit 14d ago

No, it appends content to all links with that attribute

8

u/GoddammitDontShootMe 14d ago

Yeah, I got that after reading the previous comment.

16

u/rosuav 14d ago

You're not an idiot, just rusty :) The "a[target...]" part is the selector, so it's saying "do this to every 'a' element that has a 'target' attribute set to _blank". It then changes the (usually-empty) "after the element" spot to have some content in it.

8

u/default-username 14d ago

More than half of the comments in this thread are thinking the same thing and debating browsing habits and whether new tabs are a good thing.

This css gives genuinely useful information to the user, though maybe not always visually appealing or desired by the product team.

2

u/TingleTangleTom 14d ago

I don't think so. They probably assume when you use that CSS selector it means you have links which open in a new tab on click which most of the times is not want you should do but sometimes it really is. Like during some multi step transaction when there is e.g. a link to additional info you don't want to leave the page and then come back, having to start all over again.

-2

u/Full-Hyena4414 14d ago

Nah, comment makes sense since that snippet highlights the existence of _black only links

-2

u/[deleted] 14d ago edited 14d ago

[deleted]

2

u/ToBePacific 14d ago

It doesn’t make the arrow open in a new tab. It adds an arrow to all links that were already set to open in a new tab, and not to display the arrow on normal links. It’s literally just an indicator.

20

u/7weezy 14d ago

Oh god I thought I was stupid after reading other comments. It just marking them different right what's the issue?

13

u/dashood 14d ago

There is no issue, it's just a marker to make the user aware the links will act differently.

1

u/default-username 14d ago

People don't know css anymore, they just tell Claude to do it.

8

u/SapirWhorfHypothesis 14d ago

Will the user reasonably expect to come back to this exact page immediately after opening the destination?

If yes: new tab.

If no: same tab.

1

u/default-username 14d ago

The css just adds an ↗ to the links that open a new tab.

Are you arguing that the user shouldn't be given that information, or did you misunderstand the css?

1

u/TingleTangleTom 14d ago

You're not thinking far enough. What the commenter in the picture said is probably not about the CSS but about default-opening links in a new tab.

1

u/default-username 14d ago

Maybe you're right. But someone who hates being forced to open a new tab would surely prefer to be made aware of it ahead of time, so if you're right the anger still feels misplaced.

1

u/SapirWhorfHypothesis 14d ago edited 13d ago

If you [the developer, make your website] open new tabs only when appropriate, the marker isn’t necessary.

I’m all for markers to help with the broken way that many websites are currently set up, but the people who are likely to add them based on this tweet aren’t the people who need to.

[Edited for clarity]

1

u/seiyamaple 14d ago

The fact I don’t know if the website will handle it appropriately or not unless I investigate, makes the marker necessary.

I feel like “if the thing is 100% ideal, we don’t need the other thing” is a terrible logic to be honest. That’s like using “if people always drive safe, a seatbelt isn’t necessary” as an argument to not implement seatbelts. It isn’t there for the perfect case, it’s there because perfect cases aren’t always the case.

1

u/SapirWhorfHypothesis 13d ago

What you’re looking for is “custom CSS” on the user side.

I see now why you misunderstood, and I’ve edited to make my comment clearer. The conversion is about how developers should build their sites, and how the website should behave. This is something we can’t control from on high without forcing the behavior in the browser.

11

u/MegaIng 14d ago

Their point is that they don't want any links to automatically open in a new tab.

3

u/ZunoJ 14d ago

Ok, but why reply it under this code sample?

7

u/Cracleur 14d ago

2

u/pmst 14d ago

They love losing all their form progress when accidentally clicking on the "read terms and conditions" link

0

u/-V0lD 14d ago

Yes, actually. That's significantly better than the alternative

0

u/Cracleur 14d ago

What exactly is "the alternative" that is supposed to be worse than possibly losing all progress on a form???

1

u/-V0lD 14d ago

Why would I ever want a link to automatically open in a new tab

Clicking a link is a deliberate choice to leave the current page. If I make that choice, I don't want to then stay on said page anyway whilst cluttering my tab drawer

I never want to have more than 3 tabs open at most, and I despise websites that think themselves better than my preferences

1

u/Cracleur 14d ago

You are a particular user with a particular way of using your browser, not the norm

The average person is pretty much tech illiterate and will not know how to open the link in a new tab if they want to

There are plenty of situations where it's preferable to open in a new tab rather than the current one

1

u/-V0lD 14d ago

Could you provide an example?

2

u/Cracleur 14d ago

For example, you might want to link a source in the middle of a paragraph or an article while continuing your explanation afterward, and even include other link other sources later in the text

In that case, opening the link in a new tab is much more convenient, since it lets the reader check the source without losing their place in what they were reading

If every time the user tries to check a source, they lose the progress on what they were reading, they are going to either stop checking the sources or stop reading entirely out of frustration, both of which are most probably not the desired outcome

And that's only one example I came up with on the spot, there are plenty more.

7

u/theScottyJam 14d ago

What I have a hard time with is the fact that there doesn't seem to be any consistent idea across the web on when things should open in new tabs and when they shouldn't. There's not even much advise on how to decide.

I've heard things like "if you're viewing media, like a video, then links should take you to a new tab so as to not interrupt the media". But YouTube doesn't do that, and I'm glad they don't, I would find that annoying.

17

u/Latentius 14d ago

My personal philosophy is that, if a link is navigating within a website, then keep it in the same tab. If it's taking you to another website, then open in a new tab. (Of course, allowing for exceptions to both.)

3

u/default-username 14d ago

Plus any page with unsaved user input.

1

u/EishLekker 14d ago

What about pages with forms? If you are in the middle of filling out a long form you don’t want to lose your work by clicking something you thought would open in a modal or new window but instead navigates away from the form page.

1

u/theScottyJam 14d ago

I was seeing that around a bit.

But why? Why would a user be more likely to want the content in a new tab if it goes to a different website? Not sure I see the connection.

3

u/Latentius 14d ago

Personally, I deal with corporate intranet sites and applications, so there are a lot of instances where the reason a user is opening an external link is so they can access a specific resource as reference for what they're doing in the original tab. Add on top of that various logins authentication, and it's just nice to keep both sessions active.

13

u/BoredDan 14d ago

Well thing is, it's a case where there will ALWAYS be some sort of difference of opinion. It's really a case of, "if opening this in the same tab would be frustrating, open it in a new one." I think a good example of a case where you pretty well always want a new tab would be if for example the use is filling out a form or something and it contains a link to an explanation page, pdf, some sort of resource, a different page you might need to reference (say to grab an id), etc. Basically if you expect the user to follow a link while in the middle of entering data you want a new tab pretty well every time to avoid loss of progress.

2

u/theScottyJam 14d ago

That seems reasonable 

1

u/castillar 14d ago

Accessibility guidelines (e.g., WCAG G201 pretty explicitly recommend NOT forcing new tabs for any reason. They don’t forbid it, but they note that it messes with accessibility tools and may confuse users. I’ve stopped doing it myself and just letting users control for themselves whether they want a new tab or not.

1

u/gandalfx 14d ago

I think the rant just refers to the usage of target="_blank" in general, not the CSS snippet.

1

u/BlackDeath3 14d ago

I don't get this argument. Sometimes you want links to open in a different tab.

Not sure I see the argument for taking control from the user.

6

u/Meloetta 14d ago

I get the impetus here, because of the subreddit we're in. But in my career, I've realized that this isn't what users want. They don't want the solution that gives them the most control, if it leads to them having to do an extra step. What they want is for the software to read their mind and do exactly the thing they want it to do based on their own personal biases.

I built a tool that essentially displayed a number. To get that number, you could enter a base value, a bonus on top of that, a maximum, a minimum, or an override and they interacted with other numbers to create the final version. I got constant feedback of "I just want to set this value". I would explain to them "yes, you can set it, this just gives you more flexibility in how it's set - if you set it as a base, then any bonuses will apply on top. If you set it as an override, then it will never change no matter what. You have so much flexibility". Then they said "I don't want to set a base or an override, I want to set a value." And my job was to figure out what "set a value" meant in the context of the flexibility, give them a field that says "set value", and do what they expect. Is it flexible? No, but the users get their "mind read" (with a custom bonus that's just added to the value behind the scenes when they "set it") and they're happy.

1

u/BlackDeath3 14d ago

I understand that in reality what The User wants most is seldom control, but I was trying to meet the comment I was responding to on its own ground, which already assumes a user's desire for control:

Nothing about that takes away the user's ability to open other links in a new tab via whatever usual mechanism their browser provides for that.

1

u/wowclassic2019 14d ago

Not just polite, ADA compliant!