Skip to main content

API: lightning/modal (LightningModal)

- Property: disableClose

- Expected: close button should be suppressed

- Actual: Modal still closes despite disableClose = true

- Condition: LWS enabled (Locker not in effect)

- Reproducible: 100% / Intermittent

- API Version: xx.x

- Org Type: Sandbox / Production / Scratch Org

- Workaround attempted: [none / custom CSS / manual event interception]

 

 

#Lightning Web Components  #Salesforce Platform

1 个回答
  1. 8月10日 07:10

    Hello @Michael Huang

    • Confirm LWS state properly, since stale caching can make behavior look like it's tied to LWS when it's just browser cache — refresh + hard clear cache before trusting the repro. 
    • Check whether the "close" the user triggers is the built-in header icon/ESC, or a custom button/action — if custom, that's expected behavior, not a bug.
    • Check reactivity: if disableClose is set via mutating a property on an object rather than reassigning it, LWS's proxy membrane can silently swallow that mutation for cross-namespace objects — leading to disableClose never actually flipping to true from the modal's perspective even though your component "sees" it as true. That's a classic LWS mutation-alternatives issue and worth checking with the LWS Distortion Viewer.
    • Verify ESC-key handling isn't attached at document/window level in a way that crosses the LWS namespace boundary (also part of the mutation/proxy troubleshooting docs).
    • https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-troubleshoot.html
0/9000