You need to sign in to do that
Don't have an account?
3 Creeks
Strange behavior when using modals and platformResourceLoader
I have noticed that there is some strange behavior where standard SF modal dialogs do not display after a LWC component is used that uses the lightning design system modal and a custom CSS via lightning/platformResourceLoader.
I have a LWC component that comes up in the Lightning Design System's modal (https://www.lightningdesignsystem.com/components/modals/#site-main-content). The LWC component loads a css file from static resources:
For example, if my LWC component is used on the Lead screen, once it is closed, the standard modal dialog that should come up when the Convert button is pressed does not display. Instead, the bowser window gets shaded (as it should when a modal is on the screen) but the actual modal dialog box does not appear.
To fix it, the user has to hit the refresh button.
I always know that the screen is in the strange state because I will see caret characters (^) in certain spots on the screen:
I ue Chrome browser primarily but I have also seen this in Firefox. Anyone else experience this?
Thanks
I have a LWC component that comes up in the Lightning Design System's modal (https://www.lightningdesignsystem.com/components/modals/#site-main-content). The LWC component loads a css file from static resources:
import { loadStyle } from 'lightning/platformResourceLoader'; ... import STAT_RES from '@salesforce/resourceUrl/StaticResources'; ... renderedCallback(){ loadStyle(this, STAT_RES + '/styles.css').then(()=>{ console.log("Styles loaded"); }).catch(error=>{ console.error("Error in loading styles"); }); }This modal works fine, but when the users closes the modal, the CSS from static resources seems to interfer with standard SF modal dialogs.
For example, if my LWC component is used on the Lead screen, once it is closed, the standard modal dialog that should come up when the Convert button is pressed does not display. Instead, the bowser window gets shaded (as it should when a modal is on the screen) but the actual modal dialog box does not appear.
To fix it, the user has to hit the refresh button.
I always know that the screen is in the strange state because I will see caret characters (^) in certain spots on the screen:
I ue Chrome browser primarily but I have also seen this in Firefox. Anyone else experience this?
Thanks
Strange, do you see similar behavior in any other org instance ? Also can you provide narrow down scenerio code to execute and see.
Thanks,
Here is some code to create a test modal dlg. I tried this in my environment and got the same strange behavior that I discribed in my post.
Create a LWC called resourceLoaderTest.
resourceLoaderTest.html
resourceLoaderTest.js
Add a style sheet called styles.css to your static resources
Then on some existing component, add a button or menu item to open the dialog:
component html component js
Click the button or menu item to open the test dlg and then close it. Then click something that will open a standard SF modal like Convert on the Lead screen or New Case on the Account or Contact screen.
Thanks for your help