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

select: focusOptionNode throws exception when parent container is removed from DOM during panel close #11885

Closed
@Splaktar

Description

@Splaktar

Bug

CodePen and steps to reproduce the issue:

Work in progress: https://stackblitz.com/edit/angularjs-material-11885?file=home%2Fhome.html

Detailed Reproduction Steps:

  1. The md-select needs to be in a section of the page that is hidden (or has its content hidden) by an ng-if.
  2. Click on an element that causes the ng-if to show the md-select.
  3. Click on the md-select to open the options panel.
  4. Click on an element that causes both
  5. the ng-if to hide the md-select
  6. the md-select to close its options panel

What is the expected behavior?

The md-select is hidden and the options panel closes without any exceptions or issues.

What is the current behavior?

SelectProvider.focusOptionNode() throws an exception when trying to call SelectMenuController.setActiveDescendant()

menuController.setActiveDescendant(node.id);

Because menuController is undefined. This is passed in via SelectProvider.autoFocus():
selectMenuController = opts.selectEl.controller('mdSelectMenu');
focusOptionNode(null, nodeToFocus, selectMenuController, opts.selectCtrl);

In addition to throwing the exception, there are reports that the whole app may freeze.

What is the use-case or motivation for changing an existing behavior?

Fix an edge case.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.7.9
  • AngularJS Material: 1.1.21-rc.0
  • OS: macOS
  • Browsers: Chrome 80

Is there anything else we should know? Stack Traces, Screenshots, etc.

Related to PR #11761.

Reported by @codymikol.

Metadata

Metadata

Assignees

Labels

P1: urgentUrgent issues that should be addressed in the next minor or patch release.has: Pull RequestA PR has been created to address this issueneeds: demoA CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issueseverity: regressionThis issue is related to a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions