Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dialog): add disableClose option #1678

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Nov 1, 2016

Adds a config option that allows users to disable closing a dialog via a backdrop click or pressing escape.

Fixes #1419.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 1, 2016
@jelbourn
Copy link
Member

jelbourn commented Nov 2, 2016

As mentioned in #1682, I'm thinking we should fold this into a disableClose option.

@crisbeto crisbeto force-pushed the 1419/dialog-click-outside-to-close branch from a9e4f6f to 13ebd1b Compare November 2, 2016 17:29
@crisbeto crisbeto changed the title feat(dialog): add configurable clickOutsideToClose option feat(dialog): add disableClose option Nov 2, 2016
@crisbeto
Copy link
Member Author

crisbeto commented Nov 2, 2016

Reworked to be disableClose and to include the changes from #1682 @jelbourn.

@crisbeto crisbeto force-pushed the 1419/dialog-click-outside-to-close branch from 13ebd1b to 3b6fa23 Compare November 2, 2016 17:32
@@ -25,7 +25,7 @@ import 'rxjs/add/operator/first';
host: {
'class': 'md-dialog-container',
'[attr.role]': 'dialogConfig?.role',
'(keydown.escape)': 'handleEscapeKey()',
Copy link
Member

Choose a reason for hiding this comment

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

FYI: trailing commas are preferred for this repo


viewContainerFixture.detectChanges();

let backdrop = <HTMLElement> overlayContainerElement.querySelector('.md-overlay-backdrop');
Copy link
Member

Choose a reason for hiding this comment

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

FYI, we're going to start preferring using the as HTMLElement syntax over this style cast.
(Which I still need to document in our style guide)

let dialogContainer: MdDialogContainer = viewContainerFixture.debugElement.query(
By.directive(MdDialogContainer)).componentInstance;

dialogContainer.handleEscapeKey();
Copy link
Member

Choose a reason for hiding this comment

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

Add this comment here as well:

// Fake the user pressing the escape key by calling the handler directly.

Adds a config option that allows users to disable closing a dialog via a backdrop click or pressing escape.

Fixes angular#1419.
@crisbeto crisbeto force-pushed the 1419/dialog-click-outside-to-close branch from 3b6fa23 to 1a3869b Compare November 2, 2016 18:00
@crisbeto
Copy link
Member Author

crisbeto commented Nov 2, 2016

Addressed the latest set of notes.

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 2, 2016
@jelbourn
Copy link
Member

jelbourn commented Nov 2, 2016

LGTM

@jelbourn jelbourn merged commit 93f8e04 into angular:master Nov 3, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to disable dialog click-outside-to-close
3 participants