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

Commit

Permalink
fix(chips): fixes shift+tab interaction with md-chips
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Messerle committed Apr 15, 2015
1 parent 79b0739 commit 314aae1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/chips/js/chipsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
var scope = this.$scope;
var ctrl = this;
inputElement
.attr({ tabindex: 0 })
.on('keydown', function(event) { scope.$apply(function() { ctrl.inputKeydown(event); }); })
.on('focus', function () { scope.$apply(function () { ctrl.selectedChip = null; }); });
};
Expand Down
7 changes: 4 additions & 3 deletions src/components/chips/js/chipsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@

var CHIP_INPUT_TEMPLATE = '\
<input\
tabindex="0"\
placeholder="{{$mdChipsCtrl.getPlaceholder()}}"\
aria-label="{{$mdChipsCtrl.getPlaceholder()}}"\
ng-model="$mdChipsCtrl.chipBuffer"\
Expand Down Expand Up @@ -147,7 +148,6 @@
// element propagates to the link function via the attrs argument,
// where various contained-elements can be consumed.
attrs['$mdUserTemplate'] = element.clone();
attrs['tabindex'] = '0';
return MD_CHIPS_TEMPLATE;
},
require: ['mdChips'],
Expand Down Expand Up @@ -219,13 +219,14 @@
*/
return function postLink(scope, element, attrs, controllers) {
$mdTheming(element);
element.attr('tabindex', '0');
var mdChipsCtrl = controllers[0];
mdChipsCtrl.chipContentsTemplate = chipContentsTemplate;
mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate;
mdChipsCtrl.chipInputTemplate = chipInputTemplate;

element.on('focus', function () { mdChipsCtrl.onFocus(); });
element
.attr({ ariaHidden: true, tabindex: -1 })
.on('focus', function () { mdChipsCtrl.onFocus(); });

if (attr.ngModel) {
mdChipsCtrl.configureNgModel(element.controller('ngModel'));
Expand Down

4 comments on commit 314aae1

@wnwnzhou
Copy link

Choose a reason for hiding this comment

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

Hi robertmesserle, can I know what is the reason to add ariaHidden to the md-chips directive? I found it causes the content inside md-chips cannot be announced by the screenreader. #9556

@topherfangio
Copy link
Contributor

Choose a reason for hiding this comment

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

@wnwnzhou I'll be looking into this soon.

@wnwnzhou
Copy link

Choose a reason for hiding this comment

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

@topherfangio Many thanks! Also the individual md-chip has the aria-hidden="true" applied.
Can we have a way to opt-out the aria-hidden, or remove it if not needed?

@topherfangio
Copy link
Contributor

Choose a reason for hiding this comment

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

@wnwnzhou Many updates including removal of aria-hidden are in this PR: #9650

Please sign in to comment.