Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(dialog): remove focus trap focus listeners onRemove #12012

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

Splaktar
Copy link
Contributor

@Splaktar Splaktar commented Sep 13, 2020

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added or this is not a bug fix / enhancement
  • Docs have been added, updated, or were not required

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

In MdDialogProvider.onRemove(), we currently call removeChild() on the topFocusTrap and bottomFocusTrap for the dialog and we let the browser handle GC'ing those detached Nodes. But we don't remove the 'focus' event listeners for each of these Nodes.

Issue Number:
Relates to #11207. Closes #12010.

What is the new behavior?

  • remove focus trap focus event listeners in MdDialogProvider.onRemove()
  • improve JSDoc and Closure types
  • fix typos
  • simplify isNodeOneOf() and ensure it returns a boolean
  • fix location of comments in dialog demo
  • apply some npm audit fixes to package-lock.json

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This doesn't seem to have a noticeable impact on the overall number of listeners when profiling.

Before

Screen Shot 2020-09-13 at 02 40 46

After

Screen Shot 2020-09-13 at 02 37 16

@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Sep 13, 2020
@Splaktar Splaktar requested a review from jelbourn September 13, 2020 07:48
@Splaktar Splaktar added this to the 1.2.1 milestone Sep 13, 2020
@Splaktar Splaktar added P1: urgent Urgent issues that should be addressed in the next minor or patch release. severity: memory leak Issues where a memory leak is triggered. severity: performance This issue causes a significant performance degradation type: performance This issue is related to performance labels Sep 13, 2020
@Splaktar Splaktar force-pushed the dialog-fix-leaking-listeners branch from 2f60691 to a38e607 Compare September 13, 2020 08:25
@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Sep 13, 2020
@Splaktar Splaktar self-assigned this Sep 13, 2020
- improve JSDoc and Closure types
- fix typos
- simplify `isNodeOneOf()` and ensure it returns a `boolean`
- fix location of comments in dialog demo
- apply some npm audit fixes to `package-lock.json`

Relates to #11207. Closes #12010.
Copy link
Contributor

@andrewseguin andrewseguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - in the future, it would be easier to review these if you can separate out the formatting changes in a separate commit. I assume this is an auto-format done based on changed files, so perhaps you can touch each file to format them, then commit, then make your change.

@Splaktar Splaktar merged commit 33e8bac into master Sep 14, 2020
@Splaktar Splaktar deleted the dialog-fix-leaking-listeners branch September 14, 2020 17:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ P1: urgent Urgent issues that should be addressed in the next minor or patch release. pr: merge ready This PR is ready for a caretaker to review severity: memory leak Issues where a memory leak is triggered. severity: performance This issue causes a significant performance degradation type: performance This issue is related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants