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

Some CSS Styles can't be changed #315

Open
arielmoraes opened this issue Dec 9, 2024 · 5 comments
Open

Some CSS Styles can't be changed #315

arielmoraes opened this issue Dec 9, 2024 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@arielmoraes
Copy link

I'm trying to customize some styles, but DeepChat ignores some of them, eg the border. I want to remove only the top border, but the outer container always have a full border, how can I unset the border (or any other style) and apply specific values?

@OvidijusParsiunas
Copy link
Owner

Hi @arielmoraes.

Simply using style or chatStyle should suffice:

E.g:

<deep-chat style="border: unset"></deep-chat>

<deep-chat chatStyle='{"border": "unset"}'></deep-chat>
chatElementRef.style.border = 'unset';

chatElementRef.chatStyle = {border: 'unset'};

If this does not work for you, can you provide me more information about the framework and configuration you are using.

Thanks!

@OvidijusParsiunas OvidijusParsiunas self-assigned this Dec 9, 2024
@OvidijusParsiunas OvidijusParsiunas added the advice Information how to use/implement the component label Dec 9, 2024
@arielmoraes
Copy link
Author

arielmoraes commented Dec 9, 2024

I've tried using chatStyle as follows:

deepChat.chatStyle = {
      border: 'unset',
      borderTop: '0'
 }

This results in the style being applied in the browser as:

element.style {
    border: unset;
    height: 350px;
    width: 320px;
    font-family: Inter, sans-serif, Avenir, Helvetica, Arial;
    font-size: 0.9rem;
    background-color: white;
    position: relative;
    overflow: hidden;
}

The border property is taking precedence somehow.

I solved that by using a custom class with !important on the border-top property.

I'm using the Lit framework to build a component on top of Deep Chat. By the way, great job on it.

@OvidijusParsiunas
Copy link
Owner

That is very interesting.

The border: unset; style was applied correctly to the browser DOM, but you were still seeing a border on the top? 🤷

I'm happy that you were able to resolve your issue, might you have any insight on why this was happening just for anyone that comes across a similar issue?

Thanks!

@arielmoraes
Copy link
Author

No, I want to SET only the border top, my example was misleading because the border top was 0. The problem is that even by setting the border to unset, the specific styles are ignored, so if I have a border top set as 1px it'll not work as expected,

@OvidijusParsiunas
Copy link
Owner

My apologies. I misunderstood your initial message.

I was able to reproduce your problem and was able to add a fix for it.
To note, the problem was that the component style is controlled via a CSSStyleDeclaration object, which prioritises all shorthand properties over individual properties, and because Deep Chat sets a border property by default, when you attempted to set a borderTop property it still prioritised the border property style.

This has been fixed in deep-chat-dev and deep-chat-react-dev packages version 9.0.206. These packages work exactly like the core ones, except their names are different.

I will keep this issue open until the fix has been released in the core packages. Thankyou!

@OvidijusParsiunas OvidijusParsiunas added bug Something isn't working enhancement New feature or request and removed advice Information how to use/implement the component labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants