Greetings, I have been using the Figma API for a while now and started experimenting with more specific things. In doing so, I found a potential bug relating to how constraints are represented in the Figma design file to what is coming out from the API.
Groups don’t have constraints, in the properties panel they show constraints of the nested items. Therefore it’s an error that constraints are present here at all. However, the default value is top left, and since there is no way to change it in the file, this value is shown in the REST API output.
Actually, Gleb, to make sure I understand it correctly. The group would reflect the constraints from the nested elements? If so, wouldn’t it become one of the following constraints? Or am I missing something? :
Nested Elements:
The simplePaperIcon:
with constrains: V.Scale | H.Scale
Colleges:
with constrains: V.Bottom | H.LeftAndRight
and Background:
with constrains: V.Scale | H.Scale
You have a group called “Group 2 Copy 2” and inside of it you don’t have the objects you mentioned, you have one frame object called “Group”, and frames can have constraints so “Group 2 Copy 2” reflects constraints set on that frame.
Ah, I think I got it! I think the only thing that confused me was the difference between what comes out in the JSON to that of the editor. In the editor, the “Group 2 Copy 2” does inherit the constraints of the “Group” frame; however, in the JSON “Group 2 Copy 2” does present the default values and does not inherit that of “Group”
That’s correct. The group in the editor (and in code) doesn’t actually inherit any properties from its children. It simply shows them in the properties panel when possible (e.g. constraints, color, etc.).