w3c / w3c/csswg-drafts

[resize-observer] svg interaction

Open
#4,032 4 comments 1 reaction 1 assignee View on GitHub

@gregwhitworth is already working on this.

Since Jul 10, 2019.

resize-observer-1 SVG
Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Description

ResizeObserver mentions SVG specially several times (see, for example https://drafts.csswg.org/resize-observer/#calculate-box-size). I don't recall the intent of this, but I am wondering if perhaps it is intended for observing the resizing of things inside the SVG and not the SVG itself? It seems that if I had some construct with a svg with width="100%" the SVG itself is resizing, but if it is observing the boundingBox then those things will not be reported. This little pen illustrates what I mean - here, I believe the path should fill green, but it doesn't because it seems that what is being observed is the bounding box. The pen also updates the reporting of the size of that bounding box every 100ms and as you can see, it never updates.

This seems strange and it does seem (at least from what I can tell) implemented this way in all of the browsers. As an author, it's true that you can work around this by wrapping a div around it and monitoring that instead, but that seems like a strange workaround and like maybe this creates a need for special understanding. It seems what we want to observe here is not this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.