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

Typography token aliases not being resolved

Open straef opened this issue 1 year ago • 13 comments

Describe the bug this is a bit hard to describe because i am not sure if i understand what is going on, but i think i have isolated the behavior. oh, and there are two things that may or may not be related.

in typography tokens aliases to other typography token attributes when that attribute is an alias to a non-typography token like font family (eg setting a token's font family using {TYPOGRAPHY.sometoken.fontFamily} where TYPOGRAPHY.sometoken.fontFamily = {FONTFAMILY.familytoken}) results in a broken link. the ui displays the red dot on the token name, and the broken link icon when hovered. the attribute list displays the alias and it resolves to the value of that alias. but does not get the final value, despite the aliased token having no issue.

update: i just noticed that when i attempt to apply one of these "broken" typography tokens to a text layer, the plugin toasts an error: "Error setting font family/weight combination for [familyattribute]/[weightattribute]". but i think this is a symptom rather than a cause.

additionally: making tokens as specified below and then hovering over THREE will crash the ui to a blank window. typographyONE(attributedirectlydefined) < typographyTWO{attribute} < typographyTHREE{attribute}

To Reproduce the json contains all the issues i am attempting to describe

hover over "sem-ref-direct-fontFamily" in the gui to see the crash. the broken link is displayed on "sem-ref_family-fontFamily".

Expected behavior aliasing an attribute of a token that contains a valid value, alias or otherwise, should fully resolve

the plugin should not crash when hovering a token with an alias of an alias of a direct value.

Screenshots or Screencasts image 2023-10-02 10-24-38

Figma file (optional) https://www.figma.com/file/0wmDLoE45VG6XjnrtTAGeQ/broken-token-alias-demo

JSON (optional) https://github.com/tokens-studio/figma-plugin/issues/2292#issuecomment-1777929982

straef avatar Oct 02 '23 15:10 straef