This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
select: fails to close popover on option click #12126
Labels
P3: important
Important issues that really should be fixed when possible.
severity: regression
This issue is related to a regression
type: bug
Milestone
AngularJS Material is in LTS mode
We are no longer accepting changes that are not critical bug fixes into this project.
See Long Term Support for more detail.
Bug Report
If the first option in a
<md-select>
is disabled, clicking any non-disabled option will successfully select the option but fail to close the options popover.Demo and steps to reproduce the issue
Demo URL (required)*: https://codepen.io/mockenoff/pen/BaZXVjj
Detailed Reproduction Steps
Explain the expected behavior
The option clicked should be selected and the options popover should close.
Explain the current behavior
The option clicked does become selected but the options popover remains open.
Discuss the use-case or motivation for changing the existing behavior
In any other instance, the options popover closes after clicking an option. It should be expected that it would do the same in this case, too.
List the affected versions of AngularJS, Material, OS, and browsers
Add anything else we should know
It seems to have to do with line 1911 in
select.js
.opts.focusedNode
is set to the first option if the component is instantiated with nothing selected, which naturally fails theif
since the first option is disabled and thus never makes it to the$mdSelect.hide()
call, even though a non-disabled option is being clicked.Previously, I'd been using
v1.1.4
, which instead used$mdUtil.getClosest()
to find the focused option. This change appears to have come along in thev1.1.22-rc.0
release.Stack Trace
Screenshots
The text was updated successfully, but these errors were encountered: