question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Void component that doesn't propagate events

See original GitHub issue

I am trying to create a custom Widget block component which renders an inline form allowing users to configure the Widget they selected. It uses the Void component that you provide to allow for it’s rendering within the Editor.

I have it rendering within the Editor at the moment, however I am having loads of issues with the editor responding to events based within my Widget block component. I’ve tried to put event listeners in my component and fire the e.stopPropagation() in hope that the events won’t reach the editor - but I am not having much luck.

Do you think there would be a way to isolate a Void component so that the Editor doesn’t respond to events from within it? Typically you are only after the clicked/selected event for Void components right?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ianstormtaylorcommented, Jul 28, 2016

Okay, thanks for that test case it was great!

I investigated, and realized that we should probably be not responding to events in the editor by default if they come from inside contenteditable="false" elements, whether they are in voids or not. So I’ve released 0.8.2 which has that.

I also added an embeds example which shows an editable Youtube embed, so that we can make sure it keeps working in the future!

Let me know if you still run into issues with this. Thanks for the report!

0reactions
gnestorcommented, Oct 13, 2018

It looks like this example stopped working: https://www.slatejs.org/#/embeds

I’m trying to embed a monaco editor for editing code blocks. I’ve recently migrated from draft.js and my solution with draft was to set the editor to read-only when the code block is focused. It looks like slate had this working without that hack but there may have been a regression recently…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop mouse event propagation - angular - Stack Overflow
The simplest is to call stop propagation on an event handler. $event works the same in Angular 2, and contains the ongoing event...
Read more >
The Dangers of Stopping Event Propagation - CSS-Tricks
If the click event originated from inside #menucontainer , stop that event so it will never reach the <html> element, thus only clicks...
Read more >
Bubbling and capturing - The Modern JavaScript Tutorial
The standard DOM Events describes 3 phases of event propagation: Capturing phase – the event goes down to the element. Target phase –...
Read more >
SyntheticEvent - React
This reference guide documents the SyntheticEvent wrapper that forms part of React's Event System. See the Handling Events guide to learn more.
Read more >
Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found