Figma API - how to detect whether a node/element is hidden?

Hi All,
I’m writing a plugin to Figma and I want to ignore hidden elements/nodes, but not sure what’s the proper way to do that as it’s not straight forward based on the docs:

  • The node isn’t necessarily visible if this is .visible === true.
  • The node isn’t necessarily invisible if this is .visible === false.
  • An object is visible if .visible == true for itself and all its parents.
    visible | Plugin API

Anyone was able to solve this issue and knows what’s the right logic?

Check the visible property of both the node itself and its parent, parent’s parent, etc. Or:

1 Like

So for the first approach I will need to traverse the tree until I react visible==false parent, correct?

In general, correct. But you may still need to check several properties at once (visible, opacity, absoluteRenderBounds). It all depends specifically on your needs and requirements.

It’s best to test this yourself on the nodes your plugin works with to find edge cases (such as nodes in Boolean operations, maskable objects, and nodes with zero opacity, etc.).

Thank you for the helpful advice :slight_smile: