SVG width and height are wrong when choosing "Copy SVG Code"

After upgrading to Copenhagen, if I create a frame of, say, 24x24 pxiels, select it and choose “Edit > Copy > Copy SVG Code”, I get the following output:

<svg width="107px" height="154px" viewBox="0 0 107 154" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <defs>
        <path d="M0,0 L24,0 L24,24 L0,24 L0,0 Z" id="path-0nmku_ii23-1"></path>
    </defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Frame" transform="translate(83, 130)" xlink:href="#path-0nmku_ii23-1" fill="#FFFFFF">
            <use xlink:href="#path-0nmku_ii23-1"></use>
        </g>
    </g>
</svg>

I would expect the with and height to be 24, and the viewBox to be 0 0 24 24.

If I move the frame around, I get different widths and heights (e.g. moving it up and to the left gives smaller widths and heights), so it seems like these are being calculated from some global space rather than the frame itself.

If I export the frame as an SVG rather than copying its code, I get the correct result.

Hey!

Thanks for the report, we’ve confirmed it and have shared these details with the team. Let’ see what they can find. We tested this in Barcelona (Sketch 2025.2.3) and it is working as it should!

We’ll update the thread once the team gets back to us :folded_hands:

2 Likes

The fix for this issue is now available in Sketch Copenhagen 2025.3.3 Beta.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.