Skip to content

setBoundVariable() fails to unbind width/height properties when passing null #337

@oO

Description

@oO

Bug Report: setBoundVariable() fails to unbind width/height properties

Problem Description

When attempting to unbind width or height properties from variables using setBoundVariable(property, null), the operation fails silently. The variable binding remains active, and the property continues to display the variable reference in the Figma UI.

Expected Behavior

According to the Plugin API documentation, calling setBoundVariable(property, null) should unbind the variable from the specified property, allowing direct value assignment.

Actual Behavior

  • setBoundVariable("width", null) and setBoundVariable("height", null) fail to remove variable bindings
  • The property remains bound to the variable in the Figma UI
  • No error is thrown, making this a silent failure
  • Other properties (like fills, cornerRadius) appear to unbind correctly with the same method

Reproduction Steps

  1. Create a node (e.g., rectangle) with variable-bound width/height properties
  2. Attempt to unbind using:
    node.setBoundVariable("width", null);
    node.setBoundVariable("height", null);
  3. Check the node properties - the variable bindings remain active

Code Example

// This fails silently - width remains bound to variable
rectangleNode.setBoundVariable("width", null);
rectangleNode.width = 200; // This assignment may be ignored due to persistent binding

// This works correctly for comparison
rectangleNode.setBoundVariable("fills", null);
rectangleNode.fills = [solidFill]; // This assignment works as expected

Environment

  • Figma Desktop/Browser Plugin API
  • Observed across multiple plugin implementations
  • Issue appears to be consistent regardless of variable type or node type

Impact

This bug prevents dynamic switching between variable-bound and direct value assignment for width/height properties, which is essential for:

  • Design system automation tools
  • Layout management plugins
  • Component property management systems
  • MCP (Model Context Protocol) integrations

Workaround

Currently no known workaround exists for properly unbinding width/height variables via the Plugin API.

Related Properties

The issue appears specific to width and height properties. Other dimensional properties like cornerRadius and visual properties like fills unbind correctly using the same method.

Request

Please investigate and fix the setBoundVariable() implementation for width and height properties to ensure consistent behavior across all bindable properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions