Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Adding ShadowDom support.

Open travist opened this issue 4 years ago • 6 comments

Description

This change allows for this library to work within a Shadow Dom If you have this library embedded within a shadow dom, it will not work Fixes:

  • https://github.com/jshjohnson/Choices/issues/819
  • https://github.com/jshjohnson/Choices/issues/805

Screenshots (if appropriate)

Types of changes

This adds a new configuration where you can pass the shadowRoot as a configuration. If you this configuration, then this will work in a shadow dom like so.

var shadowRoot = document.getElementById('wrapper').attachShadow({ mode: 'open' });
var choices = new Choices({
  shadowRoot: shadowRoot
});
  • [ ] Chore (tooling change or documentation change)
  • [ ] Refactor (non-breaking change which maintains existing functionality)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.

travist avatar Mar 30 '21 01:03 travist

What's the status of this PR @travist?

no-creative-name avatar Jul 23 '21 12:07 no-creative-name

Is there a chance that this request will be merged or what still needs to be done?

kozi avatar Oct 20 '22 11:10 kozi

I'm running into a similar issue. Trying to isolate the styles for the component using formio selector using Shadow Dom. Choices.js does not seem to work. @travist Do you have any idea if this PR will be merged in the near future?

karansantani avatar Dec 28 '22 17:12 karansantani

Hello, @travist. I saw that the current version of Formio has modifications to the choice js within it; how do I make this work with Angular shadow DOM? I'm stuck since I don't know how to make it work with Angular using the code you gave in the readme file.

var shadowRoot = document.getElementById('wrapper').attachShadow({ mode: 'open' });
var choices = new Choices({
  shadowRoot: shadowRoot
});

Thanks in advance.

DeekshithRajBasa avatar Jan 03 '23 15:01 DeekshithRajBasa

My workaround can be helpful for someone: #805

mariolinguito avatar Jan 15 '23 15:01 mariolinguito

is there any update on this?

verena-ifx avatar Jun 05 '23 07:06 verena-ifx