718 points · by otras · 6y ago · 312 comments
“ghci> putStrLn (pretty 10 value)”
Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books.
When you only copied: ghci> putStrLn (pretty 10 value)
Note that the quotes around your actual selection aren't even the ASCII quote character; you get horrid unicode quotes that are easy to miss if you're just trying to run a bit of code in your REPL. This isn't even a DRM ebook, so it's not like Apple is being compelled by contract to insert a citation. It's awful, user-hostile behavior that removes one of the main advantages of digital-vs-hardcopy coding books (copy/paste), and AFAIK there's no config that lets you disable it.The command's intention is so obvious I wonder why there is no warning from the os, the shell program or the terminal for such, easily blacklist-able commands. Or is there?
There's a big warning before it lets you execute the command.
Now, almost 20 years ago only RedHat did it. And it felt wrong to me :-/
It really does seem like software at Apple is being designed by people who just aren't familiar with the platform.
Apple Books is so close to being a nice reading interface, but there are so many stupid little bugs. Highlighting is another horrid little bug that can easily wipe out a full chapter’s worth of highlights with one tap...
I can only guess no one on the team actual uses the feature.
As a language learner I use Rikaikun for Japanese on my desktop browser. While I'd really like it if I could also run a similar extension in my mobile browser I'd be okay of Apple's dictionary actually worked with a fuzzy search and multiple terms... but no....
As you can see in that answer, I found a better method to assign the keyboard shortcut. Assigning the shortcut within App Shortcuts instead of Services lets you use the normal ⌘C shortcut in Books while not affecting copying in other apps.
https://devblogs.microsoft.com/oldnewthing/20140721-00/?p=45...
Why should they be ASCII, and what’s wrong with Unicode?
Unicode quotes probably aren't, so it's extra annoying to remove them, and they're not even the same character for start and end so you have to do it twice.
The time spent for removal is then vastly higher than with ASCII quotes, which in the context of unwanted characters may well qualify as "horrid" imo.
/"<CR>xnx
(or similar) in vim to delete the quotes on a multi-line block. Even that is annoying. But with the unicode quotes I have to do a bit more conscious searching, which is a distraction.Of course, the fact that the text is modified in any way is user-hostile. I don't mind re-typing a code example (since I'm trying to learn it), but I like to copy-paste sometimes (e.g. data literals).
I paid for a DRM-free ebook that's meant to be copy-pasted. We have a universal paradigm for how plaintext copy works. Apple charges a premium for good design. Ebook readers are generally supposed to get out of your way and let you focus on content. There is no reason for Apple Books to have this behavior.
sed -i '/<open quote>|<close quote>/d'
I recommend the solution in https://apple.stackexchange.com/a/382603/21473 (which is an improved variant of stassats’s solution in https://news.ycombinator.com/item?id=22355322). The method is to use Automator to set up a Quick Action that copies the text while bypassing the clipboard-modifying behavior of Books. Then you configure a keyboard shortcut of ⌘C for the Quick Action, only in the Books app, so you don’t have to change the way you copy.
Back then, I was writing papers and it was kind of handy.
Excerpt From: Bryan O’Sullivan,It sounds ridiculous, but in my experience, there are 1000 things that lawyers will identify as possible sources for legal trolling and this looks like that. Apple has a zillion dollars in the bank and they are sued daily. All it takes is for a judge who may nor not be knowledgable or a sufficiently grey area ... and you have a major problem.
So it could be risk mitigation: they are including the attribution in the copy so as to not be perceived as partisan to some kind of IP dissolution paradigm.
On the other hand, this could just be one of those wayward culty Apple kinds of things they think is 'good UI' when it's not.
Though I can see that a reasonable legal opinion might not support my more cynical view, when the risk dynamics are high, a different kind of logic creeps in.
I worked for a software platform that refused to provide usable snippets of code anywhere in the documentation for fear of liability.
We also 'perpetually sued' an organization that was infringing on our brand, even though they were really helpful to us (a user-managed fan-site which used our name in theirs) and otherwise had a positive relationship with them. Our 'perpetual legal action' was merely cover give the appearance that our brand was being defended, without which action, we could feasibly lose rights to it. So, literally suing people, while dragging out and 'nudge-nudge-winking them' to not worry about it, literally inviting the people we were suing to events, dinners etc..
I don't think most people understand the risk dynamic in many large organizations with respect to these issues, the calculation seems bizarre even to most regular product types, it really takes a legal view to understand this. And also the personal fears and biases of the executives.
Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.
Text is highlighted on the page based on the code order, not as it appears on-screen (at least in Firefox and Chrome). If you throw elements off-screen with some CSS, you can create a big disparity between what the user thinks they are selecting and what they get when they copy/paste.
e.g: https://jsfiddle.net/Lbc5gsjm/
Not quite as neat as you can't put it dynamically around exactly what you select, but my favourite example of where you could get pretty malicious with it is a “plain text” link that injects a suffix to the hostname when you copy it.
It’s awkward how easily one can break a basic functionality like select & copy.
Combine a few of those techniques with a fancy-looking text box that you are supposed to "click to copy" to get a command, and it becomes pretty easy to even write css-only "exploits" to put stuff in the clipboard!
I already mentioned this in another comment, but everyone should enable bracket paste mode in their shell to defend against this.
What is infuriating is CSS that prevents text selection in the first place. That insult to usability should have never been adopted by browsers.
As a web developer, it's kind of funny seeing people exclaim "this feature should not exist" after seeing a few abuses of it, even though they probably benefit from it every day without realizing it. Overriding copying is needed for wysiwyg editors and selection blocking is needed for many kinds of drag&drop interfaces and also editors.
Instead of complaining that useful features exist because they can be misused, maybe complain about the misuse itself - maybe even to the people actually misusing them. Shoot them an email and they might actually do something about it. Most of these misuses hurt accessibility (screen readers, etc.), so if nothing else, they'll see it as a way to reach more customers.
I think it is needed for some complex web app to handle copying non-text content. Such as images in wysiwyg editor, Google Sheets/Slides...
I'd be 110% fine with that trade and nothing of value to me would be lost.
Is it possible in Firefox? Anyone know?
The browser is no longer just a document viewer... That ship has sailed, and overall it is a good thing.
We can mitigate the risk of clipboard hijacking without burning down the house. By the way, I would guess that this is a minor risk in the grand scheme of things, as it seems that the worst risks are for technical individuals people copying programmatic commands (e.g. software engineers). For others, it is a real yet minor annoyance.
Perhaps there could be an opt-in setting for allowing a site to modify the default content that is copied from a selection?
I don't know whether that's planned to stick around or whether it was added when the clipboard event support was still experimental and will be removed at some point. But I suspect the former, for precisely the reasons in this thread.
Note that disabling these events will likely break "smart" copy/paste in things like Google Sheets, which is one reason it's not disabled by default....
You can't do it through a user agent, though
I've only ever seen that setting fix sites that try to prevent you from copying.
So many lost rants ... ;o)
For mobile devices, easiest way is to use two different browsers (one with JS disabled).
A per tab setting that remembers the JS enabled state would be very useful, with the default being JS disabled.
It ... ultimately doesn't scale. The black-hat namespaces are too large, and treating as TOFU eventually proves untenable.
Advanced features -- anything beyond rendering basic HTML, and I'd be quite prepared to argue for a very limited subset of that -- should be expressly prohibited unless enabled.
The trick is to make enabling reasonably painless and consequence-free (e.g., enable into a sandbox). There are still the problems of users gratuitously enabling anything and everything (especially when prompted through website notifications, pop-ups, phishing and vishing social engineering attacks, etc.), as well as the problem of largely invisible second and higher-order effects.
But the key is to cut down on the effectiveness of such methods, to impose costs on websites for employing them, and to make black-hat attacks through these too expensive by reducing the herd susceptibility to the attacks (the unbocking would have to occur on a one-at-a-time case-by-case basis, e.g., it's expensive and has limited scalability).
I don't think we'll actually see this for another 5-10 years (my usual sane-suggestion take-up lead time, it seems), but It Would Certainly Be Nice To See.
I had experimented with NoScript long ago, but found it a bit more cumbersome at that point because (then, before the uBlock days) I couldn’t really judge which scripts were necessary and which weren’t. I’m going to try it again.
One big plus with disabling JS is that all those ad blocker blockers and other annoying popups just don’t even appear, and that adds to a better experience.
I have JS blocked on some domains because of popups/other annoyances which make getting to the content a hassle. In those cases it's the exact opposite.
It's useful for things like rich-text editors (e.g. google docs), where the text is never on screen as text that you are able to copy in the first place.
Perhaps in a rich text editor I want to copy as plain text; or perhaps I want to make a Markdown editor that you can select+copy the Markdown but then paste HTML. Just brainstorming.
document.addEventListener('copy',
function(e){ e.stopImmediatePropagation() }
);Any time you're not interacting with HTML text is a time it could be useful.
> Ironically, a little reverse searching reveals that this code was copied verbatim without attribution from this StackOverflow post (see “Manipulating the selection” from the top answer). Maybe copy/paste isn’t so bad?
The segment I copied was just long enough that it overflowed my chat window so I had no idea the insertion was even there and I sent it as-is.
The recipient called me about two minutes later and said "hey, I think you've been hacked - you just sent me a CBD oil advertisement."
So yeah, I'd love to see user agents address this. If I push a copy button (like github's clone repo button) then fine, I'm at the mercy of their javascript. But if I copy via ctrl-C or a right click menu, it should not not let the page interfere.
This highlights the tension between the document-web and the app-web. What if the page is an image editor, word processor, spreadsheet? These app-web pages need custom logic for copy and paste. Unfortunately, bad actors (like what you found) ensure browsers cannot implement this stuff properly, because every feature is now a way to shove a new ad in.
This is a huge factor in debates about things like the merits of CSS-in-JS, or the tradeoffs in "JAMstack" architecture. Pick any polarizing facet of web development and odds are you'll find this tension at the heart of the opposing perspectives.
So these features are here to stay.
^ not gonna happen for most platforms, as it’s walled gardens all the way down, but hopefully some day it will become obvious that adcrap tech stack is a wrong foundation to make computers and their economy.
Use Firefox, go to reader mode, copy/pasta whatever you want without worries
https://moz.com/ugc/copymagicpaste-a-script-and-easytousegui...
Anecdotally speaking, I’ve seen it a lot less these days; mostly, I see it when copy-pasting from my Kindle app. I’ve rarely ever seen it for a site this general-purpose (and trivial) though
If telling people not to do this was going to be enough to solve the problem, we wouldn’t still be talking about it. The browser vendors really need to shut it off once and for all.
You know what would prevent a negative user experience? Not adding things to my clipboard that I don't want. (Thankfully, that site didn't seem to.)
The thing that annoyed me recently is that if I cut & paste a single character in Google Mail, it'll "helpfully" surround it with spaces when pasted. Other applications like Firefox or MS Word don't have this behaviour.
I just tested it, and the GMail behaviour is wonderfully inconsistent:
Copying from GMail to to plain text (e.g.: a text editor) will result in a single character.
Copying from plain text into GMail will result in no superfluous spaces.
Copying from GMail to GMail or to any "rich text" editor will add the extra spaces.
So basically I'm copying plain-text, but GMail is abusing rich-text formatting to add "magic" behaviour someone at Google assumed is beneficial, but is just confusing and arbitrary.
PS: Similarly, GMail's spell checker now "fights" with the Firefox spellchecker and the result is that neither wins and obvious typos aren't resolved unless I turn checking off and back on a couple of times.
Let me save you some time in the future. You did not identify the OS and language/script you have trouble with, so my answer has to be kinda generic.
First have a look whether your OS keyboard settings or a third party provides an en_US-101 compatible logical layout that adds more accented characters (typically accessed with right Alt¹) or extra modifier keys² (in addition to acute, grave, tilde), then install it and memorise the characters you need. Oftentimes, this is easy because it's mnemonic, e.g.
AltGr+l → ł
AltGr+d → ð
AltGr+o → ø
dead_tilde N → Ñ
dead_double_acute o → ő
dead_circumflex dead_hook O → Ổ
If that's not sufficient or too cumbersome, look into compose key³. That system is user extensible, more powerful because it provides not just accented characters, and to the most part has better mnemonics; e.g.: compose U G → Ğ
compose " y → ÿ
compose a e → æ
compose t , → ț
compose v z → ž
compose I . → İ
compose u o → ů
compose c | → ¢
compose . . → …
¹ http://enwp.org/AltGr_key
² http://enwp.org/Dead_key
³ http://enwp.org/Compose_key(FWIW I use the compose key! Just not those particular characters, my set is incidentally consistent :-))
The modifiers' proper names are "ring above" and "breve".
I'm wondering if some of these issues could be resolved with some solid industry standards.
Have you encountered any unintended consequences from disabling this?
Eg if you select text in Slack that has emojis or formatting, it tries to put plain-text into the clipboard that would produce said emojis and formatting when pasted back into Slack. This is great, and every chat app does does formatted stuff should do this.
I'd hate it if browser vendors would attempt to block this and as a result, break that kind of functionality too.
Is it great that Slack also has its own autocorrect and doesn’t know about the system autocorrect?
How would you let text input with emojis and formatting and code blocks be "handled by the system"? I agree that on most platforms, emojis are a solved problem (although the UX could be better), but the rest isn't.
Sure, like all chat apps, what Slack does is a workaround around system limitations. But the limitations are there, and they need the "copy" event to make their hack work end to end.
But this won't allow you to have a consistent emoji across platforms, neither do server-specific emoji. Besides, I found typing :emojiname: is much easier than finding emoji in emoji keyboard.
I should be able to decide if I want to allow apps to mess with my clipboard, and the default should be "no".
A stock Apple application "Books" does something similar as well. When copying text -- using keyboard shortcut or the context menu rendered as soon as you lift your mouse (another tragedy) -- your clipboard will look something like the following (2 lines):
“<what you actually wanted to copy>”
Excerpt From: <Author>. “<Title>.” Apple Books.
That gets written to your clipboard; quotes and everything.
Using org mode now, and there's probably a way to do it with emacs lisp, but... I'll never get around to it.
No user ever has ever wanted that.
So what lawyers, where, ever demanded it, and why? Short snippets fall under fair use anyways... and even if it didn't such a message doesn't prevent anything (you just delete it after pasting)... and it you were oblivious to how copyrights worked before, this isn't going to teach you.
So it's UX annoyance but why? Not only does it not provide an obvious legal benefit to any party, I don't even see how it's legally covering anyone's ass? Like, I know how under trademark law companies have to warn people against using their trademark generically or else they can lose it -- so as dumb as it is to get an e-mail from Adobe asking you not to use "Photoshop" as a verb in your press release, I get it. But copyright... doesn't work like that.
So how/why did this become a thing? I just don't understand the legal rationale here.
I am skeptical that this is a copyright issue that raised an attorney's attention. It's far more likely IMO that this was a contractual obligation imposed by the publisher.
I have no insider knowledge as to whether this is actually true, but it's quite probable that in exchange for allowing Apple Books to republish their content, the publisher required Apple to append this attribution when copying content into the clipboard. In theory, preserving such an attribution might cause more copies to be sold.
Also, contrary to your assertion, not every short snippet qualifies for a Fair Use defense; there's a four-factor test that courts apply, and the length is just one of those factors. But again, I think this less to do with copyright and more to do with a business arrangement.
I don't either, with the added bonus of a complete lack of legal training but this clipboard thing has been a part of commercial e-reader apps for so long, if your (very plausible-sounding) theory is right, it's been boilerplate in such contracts for many years.
1. Make sure many people who shared content from your site would link back to the source
2. Track shares where the full link to the page wasn't copied
3. Trick scrapers/careless plagiarists into linking back to the original source, using their own carelessness to get an extra backlink or two (and tell Google your site was the original).
All of these obviously only worked on people that didn't check what they were copying, but hey, those were some of the reasons behind it.
Does this mean that any currently running app (or maybe not even currently running, perhaps there's an event system) can see my clipboard?
My feeling about this is unprintable.
I started planning a clipboard app that doesn't allow this but I'm busy and I'd prefer this wasn't something I need to fix in the first place.
To my mind, the whole point is to provide a way to move information within and between applications.
Please do not give Apple ideas for a "App would like to access your clipboard" dialog.
On this key combination (default cmd+V), copy the data stored in this clipboard to the currently active app's own paste buffer, which will then handle inserting the data
vs
All apps can read and write to the clipboard at all times
World readable and writable files that often carry sensitive information sounds like a stupid idea to me.
Dashes https://en.wikipedia.org/wiki/Dash
Diacritics https://en.wikipedia.org/wiki/Diacritic
Precomposed Latin characters https://en.wikipedia.org/wiki/List_of_precomposed_Latin_char...
Currency symbols https://en.wikipedia.org/wiki/Currency_symbol
Japanese typographic symbols https://en.wikipedia.org/wiki/List_of_Japanese_typographic_s...
etc.
So this: "em--dash" becomes this: "em—dash" while this: "en -- dash" becomes this: "en – dash"
⌥- = en dash
⇧⌥- = em dash
where ⇧ = shift
⌥ = option
- = hyphenWe have ¼, ½, and ¾, but not en (–) and em (—) dashes; and I get that (') and (") are leftovers from typewriters and ASCII, but wouldn't it be nice to have proper 6-9 (‘…’) and 66-99 (“…”) quotation marks?
Then again, you often see Europeans online misusing acute (´) and grave ( `) accents as apostrophes (writing don´t or don`t, instead of don't or don’t). So perhaps the availability of more similar looking keys would just lead to even more misuse?
[1]: https://upload.wikimedia.org/wikipedia/commons/2/22/KB_US-In...
Even I exercised more caution when I was 12 and learning HTML, arbitrarily applying copyright to things I didn't own.
You should enable bracketed paste mode in your shell. IMO it’s much better UX than a confirmation dialog.
https://i.stack.imgur.com/855az.png
Selecting "prompt" will result in this:
https://i.stack.imgur.com/jvDUh.png
I set it to Prompt for trusted sites, and Disabled for all others.
In this case, what I'd like as a user option is to be able to say "Don't copy via app-specific code", i.e. "don't run the js event to let the page populate the clipboard, instead inspect the selection and if there is a text selection then copy that as plaintext, else copy nothing".
An alternative "prompt when the app tries to subscribe to the copy event" could also work. If I select a shape in an online diagram editor and the app says "can I please put my app-specific markup on the clipboard" then I say yes, because I understand there is now way copy paste works otherwise. And on a page when I have text selected, I can say no, and I get the default plaintext copy.
Some apps have this as 2 different functions for a formatted copy/paste vs. raw text copy paste. If browsers had a "copy text" context menu item that copied the raw selection without invoking the js 'copy' event, that would work too.
Now, there are so many advertisers that use Tynt and related services to muck with copy/paste that it wouldn't surprise me if the major browsers are incentivized to leave this alone and let users suffer.
Clipboard access isn't guaranteed to be a dark pattern, though. It's an API that the browser supports.
I dislike clipboard access 99% of the time, but it's actually useful in a few UIs (like copying keys in AWS). Should it really be up to the browser to determine that an API is always a dark pattern?
Honestly, most of the worst dark patterns of the web are enabled by regular <div>, <button>, and <img> elements -- which is to say, they're not something the browser can unilaterally decide are "evil".
There are file management apps, graphic design apps (figma), etc., that use both the clipboard and the <c-c> / <c-p> binds to work. Neither blocking the bind of <c-c> events, nor of the clipboard are going to happen.
We all have different needs and different pains. Sure, around here, we care about user experience, privacy, performance and optimizations, but let's not forget that we're in a bubble. The regular less-powered users are just as important as us, and their needs may outweight ours.
I wish there was truly open browser that was not crap, there isn't. I wish better privacy controls were available out-of-the box. I wish there could be a feature matrix backed by a default profile so that I can only give access to the clipboard / other APIs manually, but with a prompt on access attempt. I wish so much.
If I don't like my job runner, or my window manager, or even my password manager, I can go ahead and try with at least moderate success to make my own. Browsers are made by large groups of competent (most of them) polyglots, that work countless hours, willing to drill through the shit that has accumulated over the years into what we call the web. I don't have what's required to make my own browser.
Using the web with free Javascript privileges is an utterly appalling experience. I can't stand it for more than 5 seconds.
My work has switched to iPhones, and I really miss NoScript when using Safari
I haven't found a way to do this in any of the Firefox versions available for Android.
My block list is mostly well known news sites.
It's not about copyright. As a website owner, you can disable this behavior, but by default, it was enabled. The main purpose of this functionality was to track shares(for example if you copy text and send it to your friend in skype). As i remember it was one of the most popular & important features in the whole toolkit.
In a nutshell, it's about 200 lines of battle-tested javascript-code that worked perfectly fine in almost any browser(dunno about now it was around 3 years ago).
Personally, i hate this behavior.
Sure, highly technical folk are capable of working around this all -- but the vast majority of people do not have a browser that is _working for them_:
- You have little to no control over what content you are seeing. Instead, it is chosen for you.
- A large number of videos (not even including movies and shows) are geographically blocked. You cannot access them.
- Developers are actively trying to prevent: Saving images[1][2][3], selecting text[4][5], browsing on a mobile phone[6][7], and a whole slew of other normal user actions I don't care to cite: preventing users from going back, manipulating their browser history, asking for notification and geolocation permissions, displaying full-screen modals that block content access, scroll-jacking, click-jacking, and more.
But don't worry! It's not all doom and gloom, websites like Reddit, Instagram, Facebook, banks, and more are heavily pushing their users away from the web to mobile applications where you have ZERO choice.
And we're going to maintain this backwards-compatible stack of completely volatile pieces of anti-patterns until that migration to "apps" is complete, and you can no longer distinguish between the app on your phone monitoring everything you do or the site running 5 different layers of VMs and doing the same -- albeit a bit slower.
[1] https://security.stackexchange.com/questions/122922/discoura...
[2] https://stackoverflow.com/questions/21110130/protect-image-d...
[3] https://stackoverflow.com/questions/35897974/how-to-prevent-...
[4] https://stackoverflow.com/questions/16805684/javascript-disa...
[5] https://stackoverflow.com/questions/8365272/disable-copying-...
[6] https://stackoverflow.com/questions/10177456/how-to-disable-...
[7] https://stackoverflow.com/questions/22618724/how-to-disable-...
There's an easy solution. Stop. Don't run JS by default.
Not sure how to approach it. JS whitelist is a stopgap solution, but not a particularly convenient one, and it doesn't always work.
- Just throw it and the baby away, problem solved
It seems to me that we should be directing our efforts towards better browser/OS design and/or more ethical business practices than in largely futile campaigns to make people give up functionality. I'm reminded of some local activists who campaign tirelessly with posters and graffiti to have people stop driving so as to reduce fossil fuel consumption; even though I agree with them and don't drive myself, just telling people to stop is not very helpful without addressing the question of how to solve the problems that people use vehicles for in the first place.
It's all so silly and doesn't increase site visits in any meaningful way.
Sidenote: I'm glad javascript in browsers is a lot more standard so you don't have to get stupidly hacky.
Ctrl+Alt+R
Also, uMatrix with js disabled by default works well, too.For an example of what I think wad good UX: In Windows, it used to be that pasting into a text editor would give you the original text while pasting into OneNote would magically give you the text with a link back to the source below.
I used to love that and for what I know it still works, I just don't use Windows and OneNote that much anymore.
Excerpt From: Bryan O’Sullivan,I occasionally find it convenient to select hostnames out of a URL in the address bar and paste them into a terminal. Chrome "helpfully" prepends noise to the text you actually copied ("scheme://"), which makes this a PITA.