diff --git a/api-generator/components/dialog.js b/api-generator/components/dialog.js index e1200b2b5f..308dc98f2a 100644 --- a/api-generator/components/dialog.js +++ b/api-generator/components/dialog.js @@ -65,6 +65,18 @@ const DialogProps = [ default: 'true', description: 'Keeps dialog in the viewport.' }, + { + name: 'headerStyle', + type: 'object', + default: 'null', + description: 'Style of the header section.' + }, + { + name: 'headerClassName', + type: 'string', + default: 'null', + description: 'Style class of the header section.' + }, { name: 'contentStyle', type: 'object', diff --git a/components/doc/dialog/index.js b/components/doc/dialog/index.js index 1e1f3b0e6c..c00bc0a163 100644 --- a/components/doc/dialog/index.js +++ b/components/doc/dialog/index.js @@ -786,6 +786,18 @@ const myIcon = (
Dialog component uses dialog role along with aria-labelledby referring to the header element however any attribute is passed to the root element so you may use aria-labelledby to override this default behavior. +
Dialog component uses dialog role along with aria-labelledby referring to the header element however any attribute is passed to the root element so you may use aria-labelledby to override this default behavior. In addition aria-modal is added since focus is kept within the popup.
It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary.
Trigger element also requires aria-expanded and aria-controls to be handled explicitly.
diff --git a/components/lib/dialog/Dialog.d.ts b/components/lib/dialog/Dialog.d.ts index d755400130..da94954ff5 100644 --- a/components/lib/dialog/Dialog.d.ts +++ b/components/lib/dialog/Dialog.d.ts @@ -25,6 +25,8 @@ export interface DialogProps { draggable?: boolean; resizable?: boolean; modal?: boolean; + headerStyle?: object; + headerClassName?: string; contentStyle?: object; contentClassName?: string; closeOnEscape?: boolean; diff --git a/components/lib/dialog/Dialog.js b/components/lib/dialog/Dialog.js index d11c7f89eb..12d0d2655f 100644 --- a/components/lib/dialog/Dialog.js +++ b/components/lib/dialog/Dialog.js @@ -440,9 +440,10 @@ export const Dialog = React.forwardRef((props, ref) => { const icons = ObjectUtils.getJSXElement(props.icons, props); const header = ObjectUtils.getJSXElement(props.header, props); const headerId = idState + '_header'; + const headerClassName = classNames('p-dialog-header', props.headerClassName); return ( -