LWC Modal template minor corrections

Issue #2302 resolved
Xander Victory created an issue
  1. The file template’s import statement uses {LightningModal} when it should use the default import as in the docs: import LightningModal from 'lightning/modal';
  2. The embedded Typescript stubs need default added to the definition as a result (i.e. export default class)
  3. Although the docs specify it doesn’t extend LightningElement, looking at the code in Debug mode, it actually does indirectly (via lightning/overlay). Things like dispatchEvent (in the docs) and this.template definitely work
  4. The open method should probably return Promise<any> as it will return whatever was given to close

Comments (2)

  1. Scott Wells repo owner

    Thanks, Xander. I’ve addressed 1, 2, and 4 for the next build. I’m hesitant to make LightningModal extend LightningElement since it’s explicitly documented not to do so. I’d prefer to chat with the LWC folks to understand why it seems that way in spite of the documentation before changing the declaration to reflect such a relationship.

  2. Log in to comment