Closed Bug 1774786 Opened 2 years ago Closed 2 years ago

SVG <use> element resets text selection

Categories

(Core :: SVG, defect)

Firefox 101
defect

Tracking

()

RESOLVED DUPLICATE of bug 1730723

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.

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.

Component: Untriaged → SVG
Product: Firefox → Core

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.

Severity: -- → S3
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: