Cannot add spaces to extended button component based on text component.
Seems like space triggers the click event in Chrome. The solution seems to be to add the preventDefault on keypress https://stackoverflow.com/questions/22104860/chrome-firing-onclick-when-space-typed-in-contenteditable-button ps. avoid extending the view in that way. By default, when you use extend of some type, it's...
Read full answer below โQuestion
Hello guys, First of all i would like to express my gratitudes for this amazing tool. I have extended button component based on text component so as to can edit the content of button manually without using traits. The code for the extended button component is this: var comps = editor.DomComponents; var defaultType4 = comps.getType('text'); editor.DomComponents.addType('button', { model:{ defaults: { tagName: 'button', classes: ['.pointer'], //Add click pointer on hover, }, }, extend: 'text', isComponent: function (el) { if (el.tagName === 'BUTTON') return {type: 'button'}; }, view: defaultTyp...
Answers (2)
Seems like space triggers the click event in Chrome. The solution seems to be to add the preventDefault on keypress https://stackoverflow.com/questions/22104860/chrome-firing-onclick-when-space-typed-in-contenteditable-button ps. avoid extending the view in that way. By default, when you use extend...
Thanks for reporting this, @christosapos. Great question about Cannot add spaces to extended button component based on text component.. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() ev...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3287
Wrapper styling
First of all, congrats @artf for this amazing project ๐ฏ I am currently working on a project and I wanted to ask if I can edit the wrapper...
Issue #3170
Add class name from traits
Hello, what i am trying to achieve is to have the text component extended by assigning an extra trait named Alignment and deciding through...
Issue #3328
How can I update the nodeValue (text value) of components by inputs forms
Hello. Grapesjs is a great tool. Thanks for it. I want to update the text value of a component by inputs, how can I do that?? if a user fil...
Issue #3512
Child elements not draggable ,droppable highlightable. also the CSS of all child elements not pushed in style section while develop a banner component in as plugin
Hello @artf , I am trying to develop a simple banner plugin which will be include a heading , subheading and link. and every element can be...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins โ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.
Tutorial
Vanilla GrapesJS vs GrapesJS With Plugins: What You Actually Get Out of the Box (2026)
New to GrapesJS? See exactly what the stock editor gives you, where it falls short, and which plugins close the gaps โ a beginner-friendly 2026 comparison
Tutorial
Lighthouse for GrapesJS: Audit Accessibility and SEO Without Leaving the Editor
Live WCAG 2.1/2.2 accessibility auditor + SEO manager for GrapesJS. Every finding is bound to the exact component โ click to select, then one-click fix.
Tutorial
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners โ this post is for you.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.