Re: CSS and copy/pasting guidelines

> On Mar 31, 2016, at 20:04, Hallvord Reiar Michaelsen Steen <hsteen@mozilla.com> wrote:
> 
> The only remaining contentious part
> should be what to do for the plain text case - IMO having the "source
> code case" available as rich text makes it even more correct to let
> the plain text clipboard entry be as close as possible to what the
> user sees on the screen.

It's tricky, as it may affect semantics / accessibility. Consider for example a piece of Japanese text with ruby, and the full-size-kana[*] text transform applied to the ruby.

[ --- readers familiar with Japanese can skip this section

Here's what that means (simplified to what's relevant here):

* ruby text are phonetic annotations associated with the ideographic characters, and displayed above them, at a smaller font size. https://www.w3.org/TR/css-ruby-1/images/licence.png

* Kana are the syllabic characters used (among other things) for these ruby annotations. し is "shi", や is "ya". しや is "shiya". Some kana exist in a smaller variant used in special combinations, and which means a different pronunciation. しゃ (shi + small ya) is "sha".

* At the smaller font sizes used for ruby, small kana are barely legible, and it is customary to use the incorrect-but-readable larger kana, which the readers will, based on context, mentally correct.

* Markup should contain the correct spelling, and when laying it out as ruby, the full-size-kana text transform enlarges the small kana to their full size equivalent. 

---- end of Japanese writing system explanation ---- ]

When you copy a piece of text with ruby as plaintext, the ruby gets inlined. So you get something like "自動車(じどうしゃ)" which reads "ji do sha". If the text transform remains applied, you'd get "自動車(じどうしや)" which reads "ji do shi ya". Unlike with ruby styling, this is not expected by anyone and is just wrong.

The generalized version of this issue is that it may only be appropriate to preserve the text-transform if you preserve the other stylistic effects. If the author meant for his text to be always in uppercase regardless of the styles applied to it, then they should include uppercased text directly in the markup.

I get the vague feeling that we actually need both options, one that copies as plain text by giving you exactly what's in the markup, and one that tries to render into the plain text something that approximates what the rendered markup looks like. But as this distinction is likely to go way over the head of most users in most situations, figuring out a sensible UI for this is quite a challenge.

Or maybe it is on the paste side that smart things should happen, and plain text controls requesting a paste should be able to pick between pasting the basic plain text (which matches the original markup) or pasting the plain text approximation of the rich text version.

- Florian

[*] I know this text-transform doesn't exist as of today, but it likely will eventually, and makes for a good example here.

Received on Friday, 1 April 2016 00:48:24 UTC