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

Commit 869bc21

Browse files
Splaktarjelbourn
authored andcommitted
fix(chips): improve ability to receive focus on click (#11098)
this solves a regression introduced in 1.1.2 Fixes #10344
1 parent 9e6553d commit 869bc21

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/components/chips/js/chipsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ MdChipsCtrl.prototype.configureUserInput = function(inputElement) {
834834
// Find the NgModelCtrl for the input element
835835
var ngModelCtrl = inputElement.controller('ngModel');
836836
// `.controller` will look in the parent as well.
837-
if (ngModelCtrl != this.ngModelCtrl) {
837+
if (ngModelCtrl !== this.ngModelCtrl) {
838838
this.userInputNgModelCtrl = ngModelCtrl;
839839
}
840840

src/components/chips/js/chipsDirective.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
tabindex="{{$mdChipsCtrl.ariaTabIndex == $index ? 0 : -1}}"\
207207
id="{{$mdChipsCtrl.contentIdFor($index)}}"\
208208
role="option"\
209-
aria-selected="{{$mdChipsCtrl.selectedChip == $index}}" \
209+
aria-selected="{{$mdChipsCtrl.selectedChip === $index}}"\
210210
aria-posinset="{{$index}}"\
211211
ng-click="!$mdChipsCtrl.readonly && $mdChipsCtrl.focusChip($index)"\
212212
ng-focus="!$mdChipsCtrl.readonly && $mdChipsCtrl.selectChip($index)"\
@@ -376,7 +376,12 @@
376376

377377
element
378378
.attr({ tabindex: -1 })
379-
.on('focus', function () { mdChipsCtrl.onFocus(); });
379+
.on('focus', function () { mdChipsCtrl.onFocus(); })
380+
.on('click', function () {
381+
if (!mdChipsCtrl.readonly && mdChipsCtrl.selectedChip === -1) {
382+
mdChipsCtrl.onFocus();
383+
}
384+
});
380385

381386
if (attr.ngModel) {
382387
mdChipsCtrl.configureNgModel(element.controller('ngModel'));

src/core/services/interimElement/interimElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ angular.module('material.core')
88
*
99
* @description
1010
*
11-
* Factory that contructs `$$interimElement.$service` services.
11+
* Factory that constructs `$$interimElement.$service` services.
1212
* Used internally in material design for elements that appear on screen temporarily.
1313
* The service provides a promise-like API for interacting with the temporary
1414
* elements.

0 commit comments

Comments
 (0)