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

FIX: Shadow wrapper duplication #411

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/donate-button-v4/src/autoPlayMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ class WidgetController {
}

function mountShadowRoot() {
document.querySelector('#every-shadow-wrapper')?.remove();
const shadowWidgetWrapper = document.createElement('div');
shadowWidgetWrapper.id = 'shadow-wrapper';
shadowWidgetWrapper.id = 'every-shadow-wrapper';
shadowWidgetWrapper.style.position = 'absolute';
shadowWidgetWrapper.style.zIndex = '20000000';
document.body.append(shadowWidgetWrapper);
Expand Down
3 changes: 2 additions & 1 deletion packages/donate-button-v4/src/formOnlyMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export default function formOnlyMode() {
let formMountPoint: HTMLElement;

const mountWidget = () => {
document.querySelector('#every-shadow-wrapper')?.remove();
const shadowWidgetWrapper = document.createElement('div');
shadowWidgetWrapper.id = 'shadow-wrapper';
shadowWidgetWrapper.id = 'every-shadow-wrapper';
formContainer.append(shadowWidgetWrapper);

formMountPoint = document.createElement('div');
Expand Down
2 changes: 1 addition & 1 deletion packages/donate-button-v4/src/helpers/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function widgetCSS() {

if (typeof document !== 'undefined') {
insert = (rule: string) => {
const shadowRoot = document.querySelector('#shadow-wrapper');
const shadowRoot = document.querySelector('#every-shadow-wrapper');
const everyShadowStyles = shadowRoot?.shadowRoot?.querySelector(
'#every-shadow-styles'
);
Expand Down
3 changes: 2 additions & 1 deletion packages/donate-button-v4/src/manualMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export default function manualMode() {
let widgetMountPoint: HTMLElement;

const mountWidget = () => {
document.querySelector('#every-shadow-wrapper')?.remove();
const shadowWidgetWrapper = document.createElement('div');
shadowWidgetWrapper.id = 'shadow-wrapper';
shadowWidgetWrapper.id = 'every-shadow-wrapper';
shadowWidgetWrapper.style.position = 'absolute';
shadowWidgetWrapper.style.zIndex = '20000000';
document.body.append(shadowWidgetWrapper);
Expand Down
Loading