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

Allow the user to define the domTarget, which allows support for shadowDom and more #241

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

exetico
Copy link

@exetico exetico commented Jul 6, 2023

In the current state, users can't use shadowRoms with this util. Take a look at: #129, #210 and #168

I've added support for domTarget, which can be defined as an option. Documentation has been updated, too.

@exetico exetico mentioned this pull request Jul 6, 2023
@exetico
Copy link
Author

exetico commented Jul 17, 2023

Kindly take a look at this minimal change, allowing us to use the solution in a shadowDom, @nimiq & @danimoh. Thanks 😃 .

@exetico
Copy link
Author

exetico commented Sep 4, 2023

How's going team? I'd like to see this merged :) Thank you for a awesome library.

@jesseditson
Copy link

jesseditson commented Sep 25, 2023

Just a quick nit - I've moved to your branch and using shadowRoot as domTarget directly fails in typescript (although it's valid js), because the type of shadowRoot is ShadowRoot, and domTarget is typed as HTMLDivElement.

I was already embedding in a div so I could fix by grabbing the container:

const domTarget = video.parentElement as HTMLDivElement;
if (!domTarget) {
  throw new Error("Failed to find scan-area");
}

but the type should probably Element or something a bit less specific for cases where folks aren't already embedding in a div. Also the docs probably shouldn't use shadowRoot directly.

Thanks for this patch, I was about to fix this myself so it saved me a step! I'd love to see this land, even as-is.

@exetico
Copy link
Author

exetico commented Sep 26, 2023

@jesseditson Feel free to make a PR to my branch, which can be merged into the branch for the PR to the main branch.

@exetico
Copy link
Author

exetico commented Dec 7, 2023

@jesseditson Did you find some time, to implement it? You're welcome to add the PR here:

https://github.com/exetico/qr-scanner

but the type should probably Element or something a bit less specific for cases where folks aren't already embedding in a div. Also the docs probably shouldn't use shadowRoot directly.

I'm using TS in one project, so I'm not that into what's "does and donts", so I think you're more capable on adding the missing TS logics.

I'd like to have it as part of my PR, as I expect the change for the nimiq team merging it, are a bit higher. I've asked on Discord and more, but no-one replies...

@exetico
Copy link
Author

exetico commented Apr 11, 2024

@sisou What do you think ? :-)

@exetico
Copy link
Author

exetico commented Oct 29, 2024

Hi @jesseditson. Do you still use the qr-scanner lib? I've added the required changes to the branch. Else, I'd like a MCVE so I can double-check myself. I don't have a TypeScript project with shadowDom's right now, so I'd like a input on that part.

I'd hope to see this merged by the nimiq team. But I'm not sure who I should try and contact at this point. Maybe @onmax or @sisou ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants