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

tailwindcss: borders missing when using ui5-webcomponents with tailwind #8179

Closed
pskelin opened this issue Jan 25, 2024 · 1 comment
Closed
Assignees

Comments

@pskelin
Copy link
Contributor

pskelin commented Jan 25, 2024

Bug Description

When using a project with tailwind (the original issue was reported for sveltekit which includes a tailwindcss setup), the list items of a ui5-list are missing the bottom borders.

@pskelin pskelin added the bug This issue is a bug in the code label Jan 25, 2024
@pskelin pskelin changed the title Boders missing when using webcomponents with tailwind tailwindcss: borders missing when using ui5-webcomponents with tailwind Jan 25, 2024
@pskelin pskelin self-assigned this Jan 25, 2024
@pskelin pskelin removed the bug This issue is a bug in the code label Jan 25, 2024
@pskelin
Copy link
Contributor Author

pskelin commented Jan 25, 2024

Analysis

by @ilhan007

adding tailwind to a project includes a CSS reset (preflight) that removes borders from all elements:
@tailwind base

the problematic selector:

*,
::before,
::after {
  border-width: 0;
  border-style: solid;
  border-color: theme('borderColor.DEFAULT', currentColor);
}

This selector even though with low specificity is always applied before :host selectors.

ui5-li standard list item has the following selector in the shadow dom:

:host([has-border]) {
  border-bottom: var(--ui5-listitem-border-bottom);
}

Solution

In the application css, after the tailwind reset, add the following to revert the effect of the tailwind border reset for the list item:

@tailwind base;

ui5-li {
  all: revert-layer;
}

Do this for all components that are used in the application that have a default border that is hidden by the reset.

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

No branches or pull requests

1 participant