-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Broken chat UI #5409
Comments
Is nonce a static value? There seems to be a race condition or something preventing it from working properly in some cases. May we see how you're instantiating Web Chat? |
@OEvgeny, the nonce is not a static value. It's changing with every run. Here is how I instantiate the webchat:
|
Is there any update here? |
I'm still figuring out steps to repro the behavior you're seeing. |
@OEvgeny, thank you for your effort! |
Can't reproduce: https://stackblitz.com/edit/sb1-dmhmmphr?file=index.js You can verify nonce works by commenting out the property. Make sure that nonce doesn't change after Web Chat is initialized as it may affect any styles it needs to add during bootstrap. I tried Please let me know if anything from your setup is missing on the repro. |
But my repro already includes nonce as well and I'm not able to verify the issue is present on any of the above versions. Sorry to say that, but without repro it is hard to move forward on this. I've put already some time to create a repro, so anyone can access and edit it. Could you please help me to adjust the repro to better reassemble your setup? |
Hi @OEvgeny , after some trials, I am now able to reproduce using the sample you have added, here is the updated version: https://stackblitz.com/edit/sb1-9xjmqekx?file=index.html . Actually, the problem happens with some values of the nonce. It seems some special characters are breaking the code somehow. Could you please have a look and let me know your opinion? |
Here is what happens: https://stackblitz.com/edit/sb1-baunno7h?file=index.html,index.js%3AL68 The issue arises because HTML entities like To fix this, ensure you use the actual
Why this works: Browsers decode HTML entities in attributes during parsing. By using the literal Alternatively you can pass the value without html entities escaped only to JS, as the demo shows, but this is not recommended. |
Thank you @OEvgeny this solved the issue! |
Is it an issue related to Adaptive Cards?
No
Is this an accessibility issue?
No
What version of Web Chat are you using?
Latest production
Which distribution are you using Web Chat from?
Bundle (webchat.js)
Which hosting environment does this issue primarily affect?
Web apps
Which browsers and platforms do the issue happened?
Browser: Edge (latest)
Which area does this issue affect?
Customization: Branding
Which theme pack does this issue affect?
I did not test it on other theme packs
What is the public URL for the website?
No response
Please describe the bug
We have a project to integrate a copilot studio agent into our website. I face an issue with the UI CSS is not loading correctly quite often. I am attaching two images for having the chat loaded correctly vs broken one.
When I debug in developer tools to see the difference between those two cases, in the correct case I can see the styles of the dialog elements exist and it links to an element in the head similar to this
<style data-emotion="webchat--css-frzek" nonce="" data-s=""></style>
In the other case when the UI is broken, the styles of the dialog elements don't exist, although the same element exists in the head
<style data-emotion="webchat--css-frzek" nonce="" data-s=""></style>
Do you see any errors in console log?
How to reproduce the issue?
Please contact me to send you internal link in Microsoft to access the website.
What do you expect?
Having a correct non-broken UI for the chat dialog every time I refresh the page.
What actually happened?
I am adding more screenshots for the developer tool to compare the case where the UI is correctly working vs the broken UI
Correct:
Broken:
Do you have any screenshots or recordings to repro the issue?
No response
Adaptive Card JSON
Additional context
No response
The text was updated successfully, but these errors were encountered: