@@ -19,7 +19,7 @@ import { DialogConfig } from "./dialog-config.interface";
1919/**
2020 * A generic directive that can be inherited from to create dialogs (for example, a tooltip or popover)
2121 *
22- * This class contains the relevant intilization code, specific templates, options, and additional inputs
22+ * This class contains the relevant initialization code, specific templates, options, and additional inputs
2323 * should be specified in the derived class.
2424 *
2525 * NOTE: All child classes should add `DialogService` as a provider, otherwise they will lose context that
@@ -33,6 +33,7 @@ import { DialogConfig } from "./dialog-config.interface";
3333 ]
3434} )
3535export class DialogDirective implements OnInit , OnDestroy , OnChanges {
36+ static dialogCounter = 0 ;
3637 /**
3738 * Title for the dialog
3839 * @type {string }
@@ -64,7 +65,7 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
6465 @Input ( ) gap = 0 ;
6566 /**
6667 * Deprecated. Defaults to true. Use appendInline to keep dialogs within page flow
67- * Value `true` sets Dialog be appened to the body (to break out of containers)
68+ * Value `true` appends Dialog to the body (to break out of containers)
6869 */
6970 @Input ( ) set appendToBody ( v : boolean ) {
7071 console . log ( "`appendToBody` has been deprecated. Dialogs now append to the body by default." ) ;
@@ -91,6 +92,10 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
9192
9293 @HostBinding ( "attr.role" ) role = "button" ;
9394 @HostBinding ( "attr.aria-expanded" ) expanded = false ;
95+ @HostBinding ( "attr.aria-haspopup" ) hasPopup = true ;
96+ @HostBinding ( "attr.aria-owns" ) get ariaOwns ( ) : string {
97+ return this . expanded ? this . dialogConfig . compID : null ;
98+ }
9499
95100 /**
96101 * Creates an instance of DialogDirective.
@@ -170,6 +175,9 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
170175 }
171176 } ) ;
172177
178+ DialogDirective . dialogCounter ++ ;
179+ this . dialogConfig . compID = "dialog-" + DialogDirective . dialogCounter ;
180+
173181 // run any code a child class may need
174182 this . onDialogInit ( ) ;
175183 }
0 commit comments