From d564731f20a5eee6c6e373344a2bd6fc9d047e63 Mon Sep 17 00:00:00 2001 From: Ralf Koller <1665422+rpkoller@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:55:58 +0200 Subject: Dialog: Add option to put the dialog title in a header element Implement a new option: `uiDialogTitleHeadingLevel`, allowing to change the `span` wrapping the dialog title into a heading element (`h1`-`h6`). Value `0` represents the `span`, values 1-6 - a heading at the specified level. Fixes gh-2271 Closes gh-2275 --- ui/widgets/dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js index 756ad1cb1..1ef2fa3d6 100644 --- a/ui/widgets/dialog.js +++ b/ui/widgets/dialog.js @@ -81,6 +81,7 @@ $.widget( "ui.dialog", { resizable: true, show: null, title: null, + uiDialogTitleHeadingLevel: 0, width: 300, // Callbacks @@ -437,7 +438,13 @@ $.widget( "ui.dialog", { } } ); - uiDialogTitle = $( "" ).uniqueId().prependTo( this.uiDialogTitlebar ); + var uiDialogHeadingLevel = Number.isInteger( this.options.uiDialogTitleHeadingLevel ) && + this.options.uiDialogTitleHeadingLevel > 0 && + this.options.uiDialogTitleHeadingLevel <= 6 ? + "h" + this.options.uiDialogTitleHeadingLevel : "span"; + + uiDialogTitle = $( "<" + uiDialogHeadingLevel + ">" ) + .uniqueId().prependTo( this.uiDialogTitlebar ); this._addClass( uiDialogTitle, "ui-dialog-title" ); this._title( uiDialogTitle ); -- cgit v1.2.3