Bug 213095 - SVG <text> CSS not repositioning with percent translate when parent resizes
Summary: SVG <text> CSS not repositioning with percent translate when parent resizes
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari 13
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-11 15:10 PDT by Josh K
Modified: 2020-06-11 18:04 PDT (History)
6 users (show)

See Also:


Attachments
reproduction file (490 bytes, text/html)
2020-06-11 15:10 PDT, Josh K
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Josh K 2020-06-11 15:10:27 PDT
Created attachment 401683 [details]
reproduction file

Reproduction steps:

1. Create an SVG element without a viewBox, with a width dependent on the window size (either % of parent, or `vw` units)
2. Create and position a `<text>` element using `x`/`y` attributes, but also give it a %-based x-translate in CSS - `transform: translate(50%, 0);`
3. Do the same with a `<rect>` element
4. Resize the window.

Expected result:
The text and rect should reposition themselves as the window is resized, since the translate is based on the size of <svg>, which is based on the window size.

Current result:
<text> - ignores the transform entirely
<rect> - positions itself properly on initial load. However, when resizing the window, it does not reposition itself until the page is reloaded, the element is removed and re-added to the DOM, or the styling is removed and re-added to the element.

Potentially related ticket:
https://bugs.webkit.org/show_bug.cgi?id=183237

Related Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1094020
Working in Firefox 77.0.1 (64 bit)
Comment 1 Radar WebKit Bug Importer 2020-06-11 18:04:23 PDT
<rdar://problem/64278612>