Skip to content

[BUG] setPrefixedStyle silently fails for camelCase CSS property #1046

@Dario638

Description

@Dario638

Describe the bug

setPrefixedStyle in styleUtils.ts uses style.setProperty(name, value), but that function requires kebab-case/hyphen case property names (e.g. transform-origin). The only camelCase call site is setPrefixedStyle(this.textarea.style, 'transformOrigin', '0px 0px') in CellEditorHandler.ts, which is a silent no-op. This was introduced in commit 61648e4, which changed setPrefixedStyle from style[name] = value (accepts camelCase) to style.setProperty(name, value) (requires kebab-case).

To Reproduce

Steps to reproduce the behavior:

  1. Create a graph with at least one vertex
  2. Zoom to a non-1x level
  3. Double-click a cell to start editing
  4. The editor overlay is visibly offset from the cell label

Expected behavior

transform-origin: 0px 0px should be applied to the cell editor textarea. The editor overlay should align with the cell label at all zoom levels. This likely worked correctly in mxGraph.

Screenshots

N/A

Environment

  • maxGraph version or commit: present on current main
  • Desktop or mobile: Desktop
  • OS and version: Linux
  • Browser and version: Latest Chromium

Additional context

Simplest fix is probably to change the call site to kebab-case/hyphen case: setPrefixedStyle(this.textarea.style, 'transform-origin', '0px 0px');.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue/PR under review for categorization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions