Re: [csswg-drafts] [css-text] behavior of copy/paste with text-transform

On 23 October 2016 at 20:34, Christoph Päper 
<notifications@github.com>
wrote:

> Perhaps I don’t know how system clipboards actually work, but the UX
 issue
> faced here is only in *pasting*! It should have nothing to do with
> copying, no matter whether rich text or plain text. A browser should
 copy
> styled text verbatim (without character transformations) and the OS 
or the
> receiving application can then apply some irreversible changes if 
they can
> do so and do know user expectations better. CSS is the wrong place 
to “fix”
> it.
>
As far as I know, copying works by using multiple formats for the 
copied
item. See
https://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v=vs.85).aspx
as an example for Windows. E.g. if you copy some text from a website, 
it
willl be copied as plain text and in HTML format.
Plain text means that there is no styling information attached to it. 
So,
the styling information needs to be attached when the text is copied. 
The
OS doesn't transform it on pasting.

E.g. a user may expect uppercase text to be pasted as uppercase, they
usually don't care whether the author used text-transform: uppercase; 
or
actually wrote the text in uppercase letters. In other cases or for 
other
users this may not be the case.
So, as Florian said, you have to make some compromises here and I 
agree
with his points "discard as little information/semantics as possible, 
don't
surprise the user, provide the most useful behavior". And CSS does 
play a
role when doing clipboard actions. E.g. if you copy a green text as a 
user,
you expect it to be green when pasting it into a program that allows
formatting text.

One idea came to my mind right now. What if we handled the clipboard 
as
some media type? This would allow the author to control whether text 
should
be copied transformed or not. So e.g.:

h2 {
  text-transform: uppercase;
}

@media clipboard {
  text-transform: none;
}

This would even allow further modifications like e.g. resizing or 
hiding
images when copied, or removing some styling which should only be 
shown
within the browser, or display some copyright information on copied 
text.
On the other hand, authors may then break the copy/paste UX by 
choosing bad
styling.

Sebastian


-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/627#issuecomment-256123638 
using your GitHub account

Received on Tuesday, 25 October 2016 18:23:38 UTC