Issue #4208πŸ’¬ AnsweredOpened March 22, 2022by ronaldohoch2 reactions

Style click state bug in every element

Quick answerby artf❀ 1

Thanks for the report @ronaldohoch This will be fixed in the next release.

Read full answer below ↓

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Brave Last, tested on chrome last and Safari Last.

Reproducible demo link

https://grapesjs.com/demo.html

Describe the bug

How to reproduce the bug? 0. I have a video: https://www.loom.com/share/508e91098bf247bd93d525f2efa00a36

  1. Go to demo page
  2. Select any element...
  3. Set the state as click
  4. Edit any border radius
  5. Leave the element clicking in other element
  6. First bug: The UI will get the click state style and after will turn to normal state
  7. Second bug: refresh the page, normal refresh or clear the cache, will you see the styled click state before and it don't leave. I need to clear the canvas to get thinks work normally
  8. If you inspect the selected element with developer tools as i made in the video, you will see that the element gjs-selected have the styles made before as click state

What is the expected behavior? When i change the element, the click state didn't goes to all elements when clicked

What is the current behavior? click state set the styles to .gjs-selected element

If is necessary to execute some code in order to reproduce the bug, paste it here below: No.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (4)

artfβ€’ March 25, 2022

Thanks for the report @ronaldohoch This will be fixed in the next release.

ronaldohochβ€’ March 25, 2022

@artf worked! Thank you 😊

ronaldohochβ€’ March 25, 2022

@artf I couldn't run it locally because several tests didn't pass, is it like that with you too? Can I try to fix them? e.g.: image

ClaudeCodeβ€’ May 17, 2026

Thanks for reporting this, @ronaldohoch.

Great question about Style click state bug in every element. The recommended approach with StyleManager is to use the event-driven API.

Start here:

  1. Check the GrapesJS documentation for your specific module
  2. Look for the on() event listener method
  3. Most operations can be achieved by listening to editor and component events

Common patterns:

// Listen for changes
editor.on('change', () => console.log('something changed'));

// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));

If you're still stuck:

  • Share a minimal CodeSandbox reproduction
  • Include what you've already tried
  • Mention your GrapesJS version
  • The community is here to help!

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.