Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,9 @@ function MdDialogProvider($$interimElementProvider) {
for (var i = 0; i < children.length; i++) {
// skip over child if it is an ascendant of the dialog
// or a script or style tag
if (element !== children[i] && !isNodeOneOf(children[i], ['SCRIPT', 'STYLE'])) {
if (element !== children[i] &&
!isNodeOneOf(children[i], ['SCRIPT', 'STYLE']) &&
!children[i].hasAttribute('aria-live')) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a unit test for this change?

Here's an existing test for this behavior:

it('should apply aria-hidden to siblings', inject(function($mdDialog, $rootScope, $timeout) {

You should be able to follow that to create a new test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

children[i].setAttribute('aria-hidden', isHidden);
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/components/dialog/dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,23 @@ describe('$mdDialog', function() {
expect(sibling.attr('aria-hidden')).toBe('true');
}));

it('should not apply aria-hidden to live region siblings', inject(function($mdDialog, $rootScope, $timeout) {

var template = '<md-dialog aria-label="Some Other Thing">Hello</md-dialog>';
var parent = angular.element('<div>');
parent.append('<div aria-live="polite"></div>')

$mdDialog.show({
template: template,
parent: parent
});

runAnimation();

var liveRegion = angular.element(parent[0].querySelector('[aria-live]'));
expect(liveRegion.attr('aria-hidden')).toBe(undefined);
}));

it('should trap focus inside of the dialog', function() {
var template = '<md-dialog>Hello <input></md-dialog>';
var parent = document.createElement('div');
Expand Down