Clipboard.js: Modern Copy to Clipboard
github.com
github.com
My problem with text field autoselection is that it's wrecking my muscle memory of how to interact with text fields. My reflexes know that a single click places the cursor, a double click selects a word, and a triple click selects a line... except when the text field has autoselect turned on, which I can only find out after I've committed to the action. And they all behave slightly differently.
Example interaction:
- click on text field to place cursor.
- text field autoselects. I swear.
- click again to place cursor.
- hasn't been long enough since the last click, which means it's interpreted as a double click.
- text field selects word. I swear.
At this point I'll either force myself to wait for a second or so, to make the interaction time out, and then click again, or else I'll be too impatient and the madness continues as my third click is interpreted as a triple-click.
Seriously, wish there was a way to make this all stop. If I want my text fields selected, I'll do it myself, thanks.
for example, our organisation has a 'secret server', a centrally audited webserver which stores passwords and controls who can access which passwords.
Personally I think the implementation is shitty.. but without displaying the password in cleartext, copying directly to the clipboard is a preferred solution.
(even if you can potentially mis-paste.)
since it's not quantifiable I can't really argue against it.. it's just a feeling.
I used to be a heavy user of select-middle-click copy & paste. But this method of interaction seems to be increasingly broken with each new Firefox release, even without extra Javascript magic.
Manipulating the selection is probably a specific case of the larger problem of terrible, incomplete reimplementations of UI that already exists. This inevitably ends up demonstrating the exact gap between what user environment is, and what the webpage author believes it ought to be.
Selection.prototype.addRange = HTMLTextAreaElement.prototype.select = HTMLInputElement.prototype.select = function(){ console.info(this,' arificial selection disabled, sorry.') }
If you use some userscript manager, try it with
https://greasyfork.org/en/scripts/12762-disable-arificial-se..."arificial" should be "artificial" (missing 't').
i often only want some lines from it... guess what? it selects the hole thing every time you try to explicitly select a small part of it (as in dragging the mouse while clicking over one word = whole document selected)
The next time, I remember and decide to be clever. After entering the area code, I wait. But this website doesn't have the evil javascript. The time-saving javascript on the first site has made filling out the form on the innocent website take three times as long.
If you are a web developer, and you do this: stop.
This works for the North American numbers only. Get a user from the UK and you'll have to undo all this anyways.
Not to mention the complaint in parent's comment, that you can no longer copy/paste, plus the inclusion of javascript to skip to the next box (or the lack thereof) is confusing from a UX perspective.
Allow phone numbers to be entered in any format in a simple text box.
If you want, apply formatting after the fact based on the country, though I think this is even not a good idea. In some cases, the phone number won't be from the same country as the user (with VoIP and mobile, phone number locality is no longer a thing). Dialing formats are also a source of confusion, eg: do you include or require country code?
Problem is, even when I'm doing as the field expects me to (as if it had a personality) it does not work, because xterm. So sometimes I end up pasting (ctrl+v) it into the URL bar and copying (=selecting) it again, the old fashioned way. :(
More often than not I don't even bother anymore and type the URL myself.
However, it can be useful for web applications. I got a requirement in an internal app to add a button to copy some text in an administrative application. That got scrapped due to the work required to do it reliably without flash.
When there is a long string it is so much easier to just click a button instead of manually selecting the string. Yes sometimes the string is in its own field so you can use Cmd-A but a lot of times it isn't. And overwhelmingly, when someone took the time to think about what would need to be copied, and made it easier, the whole site/tool/process is much better designed.
Then I read the bottom of the readme, and noticed safari was holding back webdev once again.
I've been casually following this for the last 5 years and it seems almost too convenient that safari is regularly behind on mission critical features.
Safari is the new Internet Explorer.
Yup, all checks out.
Maybe there’s just a focus on different things between vendors: Google has tons of 20%-time engineers pushing new half-baked features in every direction (yes this is a bit of a caricature), while Apple is taking a more measured approach with a focus on performance and reliability.
Battery life it does have an advantage on, AFAIK this is widely understood and both Google and Mozilla are trying to address it (if they can, Apple does have nonpublic/undocumented APIs...). I'm surprised you find it outperforming Firefox wrt memory usage, though.
> on performance and reliability.
Good luck then trying to do anything complex with video and audio on iOS Safari. I've seen many weird quirks and bugs, strange limitations (videos always playing fullscreen on iPhone) and even browser crashes.
And considering reliability: wouldn't you agree that we would be better of using a native solution for clipboard access than the buggy and insecure Flash fallback that's needed for Safari?
It is in Apple's interest that people don't browse at all, and spend their time inside apps, where Apple has a much bigger chance of getting revenue sharing.
They are deprecating the browser, on purpose.
[Edit: this doesn't mean Apple is bad, they are just a rational company; it would be weird if they weren't doing it]
Any example of those pages that brings the computer to a crawl?
[0] http://thenextweb.com/apps/2015/08/20/chrome-is-finally-gett...
I'm sure there's some configuration setting or extension I could use to change this behavior. However, switching to Safari fixes it as well (and gets me improved battery life overall). I haven't really noticed any downsides to using Safari vs. Chrome.
The only thing that Safari is good at is memory footprint and batterly life.
An objective view: https://html5test.com/results/desktop.html
Safari is better then everything and all the rest doesn't come near. The features that it copied from Chrome made Safari worse and at they don't spy on me or sell me to advertisers.
Note: Apple has iAd and does the same, it just doesn't want Google to do it.
At least i wrote some pro's for Safari... And it's a live feature tester for HTML 5 according to the W3C HTML 5 specifications, and safari lags far behind. It runs all the test cases and the best browser comes on top. The worst browser falls behind.. In this "objective" test, Safari falls short and Chrome, Opera and Firefox are much better.
So yes, it is much more objective then your opinion ;-)
please, enlighten us.
[1] case in point: the misfeature we are discussing in this thread, which is just another addition to the big list of browser features that I have to go out of my way to disable to get a sane experience that minimises my exposure to the incompetence of web developers
That is (according to me) the true reason why Apple doesn't add features to Safari ;)
Safari is so behind even compared to IE.
Same as this project. DataTables filters out Safari for some of it's extension:
https://github.com/DataTables/Buttons/blob/master/js/buttons...
At this point I still don't buy that Apple is doing this to hold things back. Do you have other examples of when they've been behind on features with no clear explanation of why? It's okay if not - you said you were only casually following - but curious.
They wouldn't have very much to gain in my mind - none of their core business relies on locking in/out web development. They have an app market, and I guess you could argue they're trying to drive that, but they have implemented a lot of other features, and early extensions in many cases, that doesn't really align with them trying to hold web back.
Fun thing: the author of the Selection API draft works for Apple :-)
I have to ask though, what mission critical ratified features do you need that Safari lacks?
Stop trying to give webpages control - any control at all - over the browser UI. The page gets to control just that (the page) and the framework around that page (the browser). Any violation of this a potential security problem. Any time the demarcation between "remote page" and "browser UI" is blurred, problems such as "phishing" attacks become easier.
If you want fancier UI than is possible from a web page, write a native app.
Any time the demarcation between "remote page" and
"browser UI" is blurred, problems such as "phishing"
attacks become easier.
Hugely important; largely ignored.Unfortunately, people whose training and experience exists only inside a browser either don't or can't see beyond those confines and the result is reimplementing perfectly adequate external functionality.
Sometimes I am doing something on the CLI and go back to the terminal and paste a text I copied from somewhere.
If the text is multiline my terminal will consume the lines without requiring an extra 'enter / return' key press.
Another possibility is copying something to web mail client without noticing there's something suspicious about it (JS isn't the concern here anymore nowadays, but loading stuff like images is a privacy concern).
However, this issue MUST be fixed at browser level. And when used without destroying user expectations / UX, this plugin is useful.
Malicious attacks are going to happen anyways if the browser permit such action to happen, so don't blame the plugin or the plugin writer. The browsers are broken. Ask the major browser developers to either never allow it to happen (like Safari does) or ask them to ask for permission (like for webcams) or add a confirmation modal.
A trivial compromise that would be even easier to use than the current javascript/selection stuff would be a "copy to clipboard" variant of the <button> tag. Something like this should satisfy the use-cases where this clipboard nonsense is occasionally useful:
<form>
<input name="copy_souce" type="text" value="xyzzy" />
<button type="clipboard" value="copy_source"
name="Copy To Clipboard" />
</form>
This wouldn't require any Javascript, and leaves the clipboard entirely under the control of the user where it belongs.This could even be extended to allow copying of the various types of input tags, and if you wanted to get fancy, the button could reference an #id and copy that element's textContent (or innerHTML).
I know it's only existed on desktop computers since the Apple Lisa, and 30 years isn't very long for people to grasp the concept of copy and paste without a button to do it, but I have faith in people.
Maybe a small modal-like confirmation that can be placed anywhere on the viewport and is actually on top of everything natively (like Safari's copy/paste on iOS).
Of course, this modal-like confirmation must not be customized or its effect is useless.
Or let's just forget entirely and remove the functionality from the browsers.
The discussion really should focus on how well apps degrade, which is really reaffirming that progressive enhancement is still the best approach to building web apps. While only a small percentage of users have intentionally disabled JavaScript entirely, it's effectively disabled for everyone while it's downloading and a larger percentage of users (particularly on mobile) will have errors which prevent those downloads entirely. If you build a rich application which still has the core functionality working, you've done a much better job than the people who make sites which take minutes or don't even render when their shiny framework hits a non-perfect network connection.
So, for evil. Safari not supporting execCommand copy and paste is a good thing for users.
(This claims to work in all major browsers except Safari, but I'm see the same fallback when I try it in Firefox, on OS X at least -- it shows the key combination in a popup instead of actually copying or cutting the text as it does in Chrome.)
I feel like the need for a whole library here is a bit overkill if you have a "simple" usage.
you can plug into the paste pipeline and replace the data pasted when a user causes paste, either by clipboard or clicking on the browser menu/context menu though, just using the html5 events. You don't need a separate library for that.
its awesome.
1. ZeroClipboard has issues with Bootstrap tooltips on the copy button
2. This doesn't depend on Flash!
3. Gracefully downgrades to a "Press Ctrl+C to copy" message for Safari
Safari on iOS doesn't have a control key and on OS X copy is "Command-C"
But honestly the idea that someone can't select text and copy it themselves (and thus need this helper) is a stretch of reality anyway so why am I surprised that it doesn't reflect reality in its "fallback" either..
People cannot even successfully select complete URLs at an alarming frequency.
Real people have being using regular select + copy operations on their device of choice, for literally decades.
I honestly don't understand why every web app developer assumes that their user base is full of people that just picked up a device with a browser and have never used it before.
Just because your customers (assuming you do web dev) can figure things out doesn't mean everyones' can.
People wouldn't add this feature (along with the bloated library required to make it possible) to their web apps if the demand wasn't there.
"This might come in handy; better star it."
One of the banks that I consult with allow users to install the corporately limited version of Chrome, it's sometimes 10 or more versions behind latest stable, but it's better than IE8.
Bootstrap, Font-Awesome, jQuery are dropping IEx because it's a burden to maintain that for a small subset of users. We should all do the same.
My idea is if Google who owns a huge market share of the web can drop it, it's safe to say so can I.
Isn't any library released today, which improves on libraries from yesterday, by definition "modern"?
Whenever I hear "modern" I just picture the developer thumbing his nose at the old fuddy-duddies who don't know how to code and spew out garbage. Yeah yeah, I get it -- the older stuff sucks. But maybe I'm imagining it. If people here tell me that the word "modern" is truly free of derision, I'm open to that viewpoint.
I think it would be fair to describe this as a modern and quite reasonable alternative to the venerable (see what I did there?) ZeroClipboard.
Because "the people using safari" is still a thing (i dont know why)
The only thing I wish Safari had that Chrome does is profiles.
I don't open a lot of tabs on Chrome because of this.