Issue #3497💬 AnsweredOpened May 28, 2021by mosh-tudor1 reactions

Button trait command doesn't work

Quick answerby artf1

Thanks for the report @tudor-ooo will be fixed in the next release

Read full answer below ↓

Question

Version: Latest

Describe the bug detailed

https://jsfiddle.net/cleaver/wgz2jsvq/2/ Nothing happens on:

        traits: [
          {
            text: 'Simple button',
            type: 'button',
            full: true,
            command: () => {
              console.log('Broken button');
              alert('Broken button');
            },
          },
        ]

On version 0.16.45 the same code worked fine: https://jsfiddle.net/cleaver/kenvpt50/1/

Answers (2)

artfMay 31, 2021

Thanks for the report @tudor-ooo will be fixed in the next release

GJSBlockMay 17, 2026

Thanks for reporting this, @mosh-tudor. The issue with Button trait command doesn't work appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modifications overlap, creating an inconsistent state. What to try: Add a setTim...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.