Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support injecting Blockly into the shadowDom/Web Component #5230

Closed
letrthang opened this issue Jul 27, 2021 · 6 comments
Closed

Support injecting Blockly into the shadowDom/Web Component #5230

letrthang opened this issue Jul 27, 2021 · 6 comments
Labels
help wanted External contributions actively solicited issue: feature request Describes a new feature and why it should be added

Comments

@letrthang
Copy link

I would like to suggest to have plan to support Web Component with Lit-Element.

@letrthang letrthang added issue: triage Issues awaiting triage by a Blockly team member issue: feature request Describes a new feature and why it should be added labels Jul 27, 2021
@BeksOmega BeksOmega added the needs more info Waiting for developer response label Jul 27, 2021
@BeksOmega
Copy link
Collaborator

Hello, could you provide some more info about this issue? For example:

  • What problem would this solve for you?
  • How would this solve the problem?
  • What are alternatives you've considered?

Once we have a bit more info, we'll be able to better prioritize this =)

Best,
Beka

@letrthang
Copy link
Author

letrthang commented Jul 29, 2021

Hi Beka,

Basically we need to add blockly to our project which is generated by https://start.vaadin.com/welcome

My js file to load blockly is:
https://github.com/letrthang/vaadin-flow-14-starter/blob/master/frontend/views/blockly-view.js

and we got error:

blockly_error

And i think this issue is due to Blockly doesn't support Web component. The element blocklyDiv is put inside the Shadow DOM, so it cannot initialize properly.

Full proj repo (for simple, just try to run it in gitpod):
https://github.com/letrthang/vaadin-flow-14-starter

@BeksOmega BeksOmega changed the title Support Web Component Support injecting Blockly into the shadowDom/Web Component Jul 29, 2021
@BeksOmega
Copy link
Collaborator

BeksOmega commented Jul 29, 2021

Thanks for providing more info! That makes a lot of sense. I've updated the title to provide a bit more info =)

For people trying to fix this:
It looks like inject checks whether the passed div is attached to the current document, which causes the above error to be thrown. I'm not sure if this is necessary or not, since it's been there since the beginning of time.

If you are looking to fix this, you should test how it works with:

  • Elements that are attached to the dom
  • Elements that are not attached to the dom
  • Elements that are part of a shadow dom

@BeksOmega BeksOmega added help wanted External contributions actively solicited and removed needs more info Waiting for developer response issue: triage Issues awaiting triage by a Blockly team member labels Jul 29, 2021
@BeksOmega BeksOmega added this to the Bug Bash Backlog milestone Jul 29, 2021
@letrthang
Copy link
Author

Thanks Beka for helping to update this issue. Hope we will have new release to fix it soon.

@cpcallen
Copy link
Contributor

cpcallen commented Aug 9, 2021

It looks like inject checks whether the passed div is attached to the current document, which causes the above error to be thrown.

@NeilFraser: Does this check exist just to help confused programmers trying to inject Blockly into a DOM element that's not actually attached to anything, since they might otherwise wonder why doing so seems to have no effect?

Maybe the check should just be removed, or the throw replaced by a suitably-worded console.log.

@BeksOmega
Copy link
Collaborator

Apparently dupe of #1114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted External contributions actively solicited issue: feature request Describes a new feature and why it should be added
Projects
None yet
Development

No branches or pull requests

3 participants