Skip to content
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

Open
mockenoff opened this issue Oct 6, 2021 · 1 comment
Open

select: fails to close popover on option click #12126

mockenoff opened this issue Oct 6, 2021 · 1 comment
Assignees
Labels
P3: important Important issues that really should be fixed when possible. severity: regression This issue is related to a regression type: bug
Milestone

Comments

@mockenoff
Copy link

mockenoff commented Oct 6, 2021

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

  1. Click open the select.
  2. Click any option besides the disabled one.

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

  • AngularJS: 1.8.2
  • AngularJS Material: 1.2.3
  • OS: macOS
  • Browsers: Chrome, Firefox
  • Screen Readers:

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 the if 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 the v1.1.22-rc.0 release.

Stack Trace


Screenshots

@mockenoff mockenoff added needs triage Issues that need initial triage type: bug labels Oct 6, 2021
@Splaktar Splaktar self-assigned this Oct 7, 2021
@Splaktar Splaktar added P3: important Important issues that really should be fixed when possible. and removed needs triage Issues that need initial triage labels Oct 7, 2021
@Splaktar
Copy link
Member

Splaktar commented Oct 7, 2021

This looks like it may be a regression in 1.1.22: 928c71d

@Splaktar Splaktar added this to the 1.2.4 milestone Oct 7, 2021
@Splaktar Splaktar added the severity: regression This issue is related to a regression label Oct 28, 2021
@Splaktar Splaktar modified the milestones: 1.2.4, 1.2.5 Nov 18, 2021
@Splaktar Splaktar modified the milestones: 1.2.5, 1.2.6 Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3: important Important issues that really should be fixed when possible. severity: regression This issue is related to a regression type: bug
Projects
None yet
Development

No branches or pull requests

2 participants