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

black color on buttons in ui #64

Merged
merged 2 commits into from
Mar 22, 2022
Merged

Conversation

nilzona
Copy link
Contributor

@nilzona nilzona commented Feb 21, 2022

this is a little bit of a "guess fix" from my side. But I believe it would resolve the issue I have.

resolves #63

@@ -235,4 +239,5 @@
line-height: 22px;
border: none;
padding: 5px;
color: black;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would work to add color: black in the selector above for both cases, but that would maybe give some side-effects ... I haven't tested all cases.

@ralphsaunders
Copy link
Contributor

We also experience this issue in our codebase.

In our case, this happens when styles get written to page that set button to be color: inherit, which means buttons inherit their colour from the popup - https://github.com/joeldenning/import-map-overrides/blob/main/src/ui/import-map-overrides.css#L38

Whilst we could try writing the CSS a little more defensively, it may be more reliable to render the UI to ShadowDOM.

https://github.com/joeldenning/import-map-overrides/blob/main/src/ui/custom-elements.js#L38

/**
 * Now
 */
this.renderedEl = render(
    h(Comp, { customElement: this }),
    this,
    this.renderedEl
);


/**
 * Shadow DOM
 *
 * In practice, CSS may need to be injected as a style tag into the root of the new Shadow DOM element.
 */
this.shadow = this.createShadowRoot();
this.renderedEl = render(
    h(Comp, { customElement: this }),
    this.shadow,
    this.renderedEl
);

@joeldenning If you're happy with the above direction I can raise an alternative PR.

Cheers,
Ralph

@joeldenning
Copy link
Member

I'm not opposed to switching to shadow DOM, but am going to accept this contribution as-is as a patch fix.

@joeldenning joeldenning merged commit d75295d into single-spa:main Mar 22, 2022
@joeldenning
Copy link
Member

@nilzona nilzona deleted the fix-button-style branch March 23, 2022 06:41
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.

buttons in ui can get "bad" styling
3 participants