SVG <use> element resets text selection
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: manikulin, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0
Steps to reproduce:
Text selection is lost when mouse is over a <svg>
element that includes a fragment from another file through <use>
element.
Maybe there is a way to reproduce the issue without custom server, but I have almost no experience with using SVG in HTML. I just faced the problem on a website.
- Serve the following HTML and SVG files by some HTTP server (adjust xlink path if necessary)
python3 -m http.server --bind 127.0.0.1 8080
- Visit http://127.0.0.1:8080/ in Firefox
- Start text selection and move mouse over second image (top right triangle)
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bug: SVG image breaks selection</title>
</head>
<body>
<h1>Bug: SVG image breaks selection</h1>
<div>Simple embedded SVG
<svg width="24" height="24"><path d="M4 4L20 20 4 20z"/></svg>
does not affect selection.</div>
<div>If a fragment is included using <code>use</code> element
<svg width="24" height="24"><use
xlink:href="http://127.0.0.1:8080/img.svg#something"
></use></svg>
then it resets selection when mouse is over it. A workaround is
to move mouse aside from the image.
</div>
</body>
</html>
img.svg
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="something" viewBox="0 0 24 24"><path d="M4 4L20 20 20 4z"/></symbol>
</svg>
Actual results:
Selection is cleared
Expected results:
There is no problem to select text even there is a SVG image in the middle.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::SVG' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
|
||
Seems to be specific to use of that <use href="..."></use>
tag.
Wonder if it has to do with the security error that pops up when trying to launch the local file instead of accessing it from the server.
Comment 3•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Description
•