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
19 changes: 1 addition & 18 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,19 +723,9 @@ function MdDialogProvider($$interimElementProvider) {
return dialogPopIn(element, options)
.then(function() {
lockScreenReader(element, options);
warnDeprecatedActions();
focusOnOpen();
});

/**
* Check to see if they used the deprecated .md-actions class and log a warning
*/
function warnDeprecatedActions() {
if (element[0].querySelector('.md-actions')) {
$log.warn('Using a class of md-actions is deprecated, please use <md-dialog-actions>.');
}
}

/**
* For alerts, focus on content... otherwise focus on
* the close button (or equivalent)
Expand All @@ -753,14 +743,7 @@ function MdDialogProvider($$interimElementProvider) {
* If we find no actions at all, log a warning to the console.
*/
function findCloseButton() {
var closeButton = element[0].querySelector('.dialog-close');

if (!closeButton) {
var actionButtons = element[0].querySelectorAll('.md-actions button, md-dialog-actions button');
closeButton = actionButtons[actionButtons.length - 1];
}

return closeButton;
return element[0].querySelector('.dialog-close, md-dialog-actions button:last-child');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ md-dialog {
}
}

.md-actions, md-dialog-actions {
md-dialog-actions {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should leave the style classes for deprecated support (while we removing the warnings).
Otherwise this is a breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

We had them since pre v1.0.0 that's why I intentionally removed them for now. The target is to remove the deprecation completely (two major versions~)

display: flex;
order: 2;
box-sizing: border-box;
Expand All @@ -100,7 +100,7 @@ md-dialog {
}
}
&.md-content-overflow {
.md-actions, md-dialog-actions {
md-dialog-actions {
border-top-width: 1px;
border-top-style: solid;
}
Expand Down
19 changes: 0 additions & 19 deletions src/components/dialog/dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,25 +1197,6 @@ describe('$mdDialog', function() {
expect($document.activeElement).toBe(parent[0].querySelector('#focus-target'));
}));

it('should warn if the deprecated .md-actions class is used', inject(function($mdDialog, $rootScope, $log, $timeout) {
spyOn($log, 'warn');

var parent = angular.element('<div>');
$mdDialog.show({
template:
'<md-dialog>' +
'<div class="md-actions">' +
'<button class="md-button">Ok good</button>' +
'</div>' +
'</md-dialog>',
parent: parent
});

runAnimation();

expect($log.warn).toHaveBeenCalled();
}));

it('should only allow one open at a time', inject(function($mdDialog, $rootScope, $animate) {
var parent = angular.element('<div>');
$mdDialog.show({
Expand Down