spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

fix(overlay): prevent modal overlays from closing and fix memory leak

Open lehelen19 opened this issue 1 year ago • 0 comments
trafficstars

Description

Prevents a modal overlay that's not on top of the stack from closing when a user clicks outside of the overlay's ancestor path. For example, when there are two modal overlays stacked on top of each other, clicking on the top overlay will not close the one below it.

Additionally, clean up the reference to this.lastOverlay to prevent a memory leak.

Related issue(s)

  • https://github.com/adobe/spectrum-web-components/issues/4553

Motivation and context

Before the Overlay v2 API changes, overlays would behave as described above. It is unexpected for the overlay on the bottom to close on a random click, especially when the top overlay doesn't close.

How has this been tested?

We are actively testing this behavior in Express.

  • [ ] Test case 1
    1. Go here
    2. Do this
  • [ ] Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • [x] I have signed the Adobe Open Source CLA.
  • [x] My code follows the code style of this project.
  • [x] If my change required a change to the documentation, I have updated the documentation in this pull request.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.
  • [x] I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

lehelen19 avatar Jun 12 '24 21:06 lehelen19