Skip to content

Commit

Permalink
Close dialog on dismiss
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ju committed Oct 13, 2022
1 parent 6c8b3ac commit 70281b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/components/addon/components/hds/dialog/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<span class="hds-dialog__title" id={{@id}}>
{{yield}}
</span>
<button class="hds-dialog__dismiss" type="button" aria-label="Dismiss">
<button class="hds-dialog__dismiss" type="button" aria-label="Dismiss" {{on "click" @closeDialog}}>
<FlightIcon @name="x" @size="16" @isInlineBlock={{false}} />
</button>
</div>
6 changes: 6 additions & 0 deletions packages/components/addon/components/hds/dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ export const TYPES = ['neutral', 'warning', 'critical'];
export default class HdsDialogIndexComponent extends Component {
@action
setupDialog(element) {
this.element = element;
element.showModal();
}

@action
closeDialog() {
this.element.close();
}

/**
* Sets the size of the dialog
* Accepted values: small, regular, large
Expand Down

0 comments on commit 70281b4

Please sign in to comment.