figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

Tokens that share name with a group are not visible in the UI

Open Design2Well opened this issue 2 years ago • 3 comments

When using a naming convention that's shared (i.e. in both typography and composition tokens within the same token set, the nested composition tokens are not visible within the plugin UI even though they are available as unique tokens in the JSON. For example, after adding the {bjc.type.p.lg.bold.defaultColor} token to the Composition token section within the UI, the Typography token {bjc.type.p.lg.bold} remains visible but the Composition token does not.

{
  "bjc": {
    "type": {
      "p": {
        "lg": {
          "bold": {
            "value": {
              "fontFamily": "{bjc.fontFamilies.open-sans}",
              "fontWeight": "{bjc.fontWeights.700}",
              "lineHeight": "{bjc.lineHeights.2}",
              "fontSize": "{bjc.fontSize.lg}",
              "letterSpacing": "{bjc.letterSpacing.4}",
              "paragraphSpacing": "{bjc.paragraphSpacing.lg}",
              "textCase": "{bjc.textCase.none}",
              "textDecoration": "{bjc.textDecoration.none}"
            },
            "type": "typography",
            "description": "18px / 1.125rem",
            "defaultColor": {
              "value": {
                "typography": "{bjc.type.p.lg.bold}",
                "fill": "{bjc.colors.type.body.default}"
              },
              "type": "composition"
            }
          }
        }
      }
    }
  }
}

Only when I move the typography token to a different token set does this not occur. For example...

Token set A

{
  "bjc": {
    "type": {
      "p": {
        "lg": {
          "bold": {
            "value": {
              "fontFamily": "{bjc.fontFamilies.open-sans}",
              "fontWeight": "{bjc.fontWeights.700}",
              "lineHeight": "{bjc.lineHeights.2}",
              "fontSize": "{bjc.fontSize.lg}",
              "letterSpacing": "{bjc.letterSpacing.4}",
              "paragraphSpacing": "{bjc.paragraphSpacing.lg}",
              "textCase": "{bjc.textCase.none}",
              "textDecoration": "{bjc.textDecoration.none}"
            },
            "type": "typography",
            "description": "18px / 1.125rem"
            }
          }
        }
      }
    }
  }
}

Token set B

{
  "bjc": {
    "type": {
      "p": {
        "lg": {
          "bold": {
            "defaultColor": {
              "value": {
                "typography": "{bjc.type.p.lg.bold}",
                "fill": "{bjc.colors.type.body.default}"
              },
              "type": "composition"
            }
          }
        }
      }
    }
  }
}

Is this a bug? It would be ideal if the UI would not hide these tokens.

Design2Well avatar Jul 07 '22 17:07 Design2Well

This is currently intended as a token name should not share a name with a group.

This was based on a prior draft of the W3C which specified that this should be the case.

In the newest draft this is however not found anymore, so in the future we'll support this as well (once we've moved on to support the new version of the draft)

six7 avatar Jul 08 '22 19:07 six7

Any estimated timing for supporting the new W3C draft?

Design2Well avatar Jul 13 '22 20:07 Design2Well

We'll be supporting this in the next release, even before the new W3C draft.

six7 avatar Jul 23 '22 07:07 six7

This would be great. In figma, we can use the same name for a color style and a color style group.

However, it seems that the change is moved from 🤞 To be released to 🗃️ Backlog and not yet released. Is there anything to reconsider?

yunhao avatar Oct 04 '22 16:10 yunhao

@six7 assuming this one can be closed but I'm not sure

SamIam4Hyma avatar Mar 20 '24 21:03 SamIam4Hyma