Reputation: 1886
Note: this question is about the html <ruby>
element. It is not related to the ruby language.
I have a web page that contains ruby markup elements. Here's a simplified example:
<html>
<body>
Before
<ruby>
<rb>XYZ</rb>
<rt>This is base</rt>
</ruby>
After
<body>
</html>
I would like my uses to be able to select the text, copy/paste to another program, and get
Before This is base After
But, at least in Chrome, what is copied is
Before XYZ This is main After
How can I alter my markup to get this behavior?
I'd be thrilled with a browser-independent solution, but even Chrome-only would be useful.
FWIW, the original draft spec seemed to call for this to work somehow. https://www.w3.org/TR/ruby-use-cases/ contains the line "Ruby text annotations should be disregarded in some situations, such as finding text or copying text". But there is no detailed discussion of this in that document.
Upvotes: 1
Views: 324
Reputation: 1886
Found the answer!
Give the rt
element CSS of user-select: none
.
(See answers in How to disable text selection highlighting for rationale and browser-compatibility details).
Upvotes: 2