From 6eff29e867fcbcd2bc94413a7db58554ba90e61b Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 28 Nov 2023 11:26:13 +0100 Subject: [PATCH 01/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added a label to the editable properties in edit mode. Note: this does not solve the reported issue --- .../webapp/resources/uicomponents/edit/editableProperty.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index 98c7ff5bb850..dda887a0023c 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -130,7 +130,10 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { // Allow others to enhance the editor. $(document).trigger('xwiki:dom:updated', {'elements': editor.toArray()}); // Focus the first visible input. - editor.find(':input').filter(':visible').focus(); + var editInput = editor.find(':input').filter(':visible'); + editInput.focus(); + // Bind the label to the newly generated edit input + editableProperty.find('label').attr('for',editInput.attr('id')); }).catch(() => { new XWiki.widgets.Notification(l10n['web.editableProperty.editFailed'], 'error'); return Promise.reject(); From 14d4148997374d35e1288d6832aa4cc732cca17b Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Wed, 29 Nov 2023 16:46:00 +0100 Subject: [PATCH 02/20] XWIKI-20996: AWM entry edit forms don't have labels. * Fixed the lack of ids on a couple 'hard coded' fields --- .../src/main/resources/AppWithinMinutes/Title.xml | 4 +++- .../webapp/resources/uicomponents/edit/editableProperty.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index 0b3170f3ffb1..a8e688b87aa6 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -52,7 +52,9 @@ #end #end {{html clean="false"}} - <input type="text" name="$name" value="$!escapetool.xml($value)" + ## We can assume that the title is unique, since the property name is the same, all the values are tied together + ## anyways. + <input id="entryTitle" type="text" name="$name" value="$!escapetool.xml($value)" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index dda887a0023c..f494c5dcceb9 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -132,6 +132,10 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { // Focus the first visible input. var editInput = editor.find(':input').filter(':visible'); editInput.focus(); + // Make sure the edit input has an ID, and use the name of the input as a fallback + if (!editInput.attr('id')) { + editInput.attr('id', editInput.attr('name')); + } // Bind the label to the newly generated edit input editableProperty.find('label').attr('for',editInput.attr('id')); }).catch(() => { From 4b7fe5c9684d65a1d29c2935a93f57402856f9d2 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Fri, 1 Dec 2023 11:10:36 +0100 Subject: [PATCH 03/20] XWIKI-20996: AWM entry edit forms don't have labels. * Fixed the lack of ids on a couple 'hard coded' fields --- .../it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java | 3 ++- .../src/main/resources/AppWithinMinutes/Title.xml | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java index bc1e28841489..5d06c81c4244 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java @@ -115,7 +115,8 @@ void deleteField(TestUtils setup, TestReference testReference) editor.addField("Date").setPrettyName("Day"); // Save and assert they are present. - ViewPage classView = editor.clickSaveAndView(); + editor.clickSaveAndView(true); + ViewPage classView = editor.createPage(); assertTrue(classView.getContent().contains("Available (boolean1: Boolean)")); assertTrue(classView.getContent().contains("Day (date1: Date)")); diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index a8e688b87aa6..0b3170f3ffb1 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -52,9 +52,7 @@ #end #end {{html clean="false"}} - ## We can assume that the title is unique, since the property name is the same, all the values are tied together - ## anyways. - <input id="entryTitle" type="text" name="$name" value="$!escapetool.xml($value)" + <input type="text" name="$name" value="$!escapetool.xml($value)" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end From 6477c858ce2f91b011f5b283e8facdd65ecffcdd Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 22 Oct 2024 16:41:43 +0200 Subject: [PATCH 04/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added localized and escaped aria labels for both the title and content fields. --- .../it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java | 3 +-- .../src/main/resources/AppWithinMinutes/Content.xml | 4 +++- .../src/main/resources/AppWithinMinutes/Title.xml | 1 + .../src/main/resources/AppWithinMinutes/Translations.xml | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java index 5d06c81c4244..bc1e28841489 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-test/xwiki-platform-appwithinminutes-test-docker/src/test/it/org/xwiki/appwithinminutes/test/ui/ClassEditorIT.java @@ -115,8 +115,7 @@ void deleteField(TestUtils setup, TestReference testReference) editor.addField("Date").setPrettyName("Day"); // Save and assert they are present. - editor.clickSaveAndView(true); - ViewPage classView = editor.createPage(); + ViewPage classView = editor.clickSaveAndView(); assertTrue(classView.getContent().contains("Available (boolean1: Boolean)")); assertTrue(classView.getContent().contains("Day (date1: Date)")); diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index b6c5b146bd16..00de3c489e95 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -61,7 +61,9 @@ #set ($toolBar = "#template('simpleedittoolbar.vm')") $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. - <textarea id="$id" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> + <textarea id="$id" cols="80" rows="25" name="$name" ## + aria-label="$services.localization.render('platform.appwithinminutes.content.edit.label')">## + $escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index 0b3170f3ffb1..f3af7f06fb82 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -53,6 +53,7 @@ #end {{html clean="false"}} <input type="text" name="$name" value="$!escapetool.xml($value)" + aria-label="$escapetool.xml($services.localization.render('platform.appwithinminutes.title.edit.label'))" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml index f5c017307449..95589ae640da 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml @@ -46,6 +46,8 @@ platform.appwithinminutes.appsLiveTable.doc.author=Last author platform.appwithinminutes.appsLiveTable.doc.date=Update date platform.appwithinminutes.appsLiveTable._actions=Actions platform.appwithinminutes.grantSpaceAdminRightsSaveComment=Grant space administration rights. +platform.appwithinminutes.title.edit.label=Edit the title of this entry. +platform.appwithinminutes.content.edit.label=Edit the content of this entry. ### AWM Applications panel entry platform.appwithinminutes.appPanelCreateEntry=Create your own! From 00583b67899da54e474d941864032d5a830566c4 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 22 Oct 2024 17:05:41 +0200 Subject: [PATCH 05/20] XWIKI-20996: AWM entry edit forms don't have labels. * Escaped the content aria-label --- .../src/main/resources/AppWithinMinutes/Content.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index 00de3c489e95..4b704bd4d6bd 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -62,7 +62,7 @@ $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. <textarea id="$id" cols="80" rows="25" name="$name" ## - aria-label="$services.localization.render('platform.appwithinminutes.content.edit.label')">## + aria-label="$escapetool.xml($services.localization.render('platform.appwithinminutes.content.edit.label'))">## $escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) From e5651162f1f29aa9121b8806713f16e82f6ef638 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 14:57:13 +0100 Subject: [PATCH 06/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added comments in ClassEditSheet * Extended the input selector in _enhanceFieldDefaultValue so that the labelling would also work on select (eg. fieldType = StaticList) * Set an aria-label on default value fields, equal to the title. We don't care about the existing state, this label is always the same for all fields. * Added a translated label on the field hint/prettyName inputs in class edition mode. * Added the `for` attribute on the label even in view mode, so that the inline edition input is properly labelled. * Updated the id of the content textarea. The only style left that relied on this was unneeded (same property set by another style...). Moreover the functionality did not suffer when changing this. This allows to use the id to label the textarea instead of relying on an aria-label. * Used a proper label instead of aria-label on the Title input. --- .../main/resources/AppWithinMinutes/ClassEditSheet.xml | 10 ++++++++-- .../resources/AppWithinMinutes/ClassSheetGenerator.xml | 2 +- .../src/main/resources/AppWithinMinutes/Content.xml | 8 +++----- .../src/main/resources/AppWithinMinutes/Title.xml | 5 ++--- .../main/resources/AppWithinMinutes/Translations.xml | 2 ++ .../src/main/resources/flamingo/less/edit.less | 4 ---- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml index eade57c3b882..f52d8b50fa75 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml @@ -314,6 +314,7 @@ xcontext.put('propertyCustomDisplayer', new PropertyCustomDisplayer(xcontext)) * Displays a configuration property of a class field. This macro can also be used to display a property of an object. *# #macro (displayFieldProperty $property $prefix $field) + ## This 'displayFormType' property only exists for boolean fields. #set ($displayFormType = $property.getProperty('displayFormType')) #if ($property.classType == 'Boolean' && (!$displayFormType || $displayFormType.value == 'checkbox')) <dt> @@ -1392,8 +1393,10 @@ XWiki.FormFieldPrettyNameManager = Class.create({ var label = previousDT.down('label'); prettyNameInput.title = label.textContent || label.innerText; } + prettyNameInput.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldPrettyNameToolTip'))'; // Replace the preview label with the pretty name input. var previewLabel = field.getViewer().down('label'); + // We unset the for attribute, so that this label will not be set implicitely OR explicitely anymore. previewLabel.writeAttribute('for', ''); previewLabel.removeChild(previewLabel.lastChild); previewLabel.insert(prettyNameInput); @@ -1418,10 +1421,12 @@ XWiki.FormFieldDefaultValueManager = Class.create({ _enhanceFieldDefaultValue : function(event) { var field = event.memo.field; var fieldName = field.getName(); - field.getViewer().select('input[type=text]', 'textarea').each(function(input) { + // We select the default field input and update it. + field.getViewer().select('dd :input').each(function(input) { if (!input.title && input.name.endsWith('_0_' + fieldName)) { input.title = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldDefaultValueToolTip'))'; } + input.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldDefaultValueToolTip'))'; }); }, _onSave : function() { @@ -1456,7 +1461,8 @@ XWiki.FormFieldHintManager = Class.create({ if (hintInput) { hintInput.addClassName('xHint'); if (!hintInput.title) { - hintInput.title = 'Hint'; + hintInput.title = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldHintToolTip'))'; + hintInput.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldHintToolTip'))'; } // Move the hint input below the pretty name input, in the field viewer. var dd = hintInput.up('dd'); diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml index 832bd0acc612..8d8e5211df8b 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml @@ -49,7 +49,7 @@ ${indentation}<dt ${escapetool.h}if (!${escapetool.d}editing && ${esc ${indentation} class="editableProperty" ${indentation} data-property="${escapetool.d}escapetool.xml(${escapetool.d}services.model.serialize(${escapetool.d}object.getPropertyReference('#escapeSingleQuotes($property.name)')))" ${indentation} data-property-type="object"${escapetool.h}end> -${indentation} <label${escapetool.h}if (${escapetool.d}editing) for="$escapetool.xml("${doc.fullName}_0_$property.name")"${escapetool.h}end> +${indentation} <label for="$escapetool.xml("${doc.fullName}_0_$property.name")"> ${indentation} ${escapetool.d}escapetool.xml(${escapetool.d}doc.displayPrettyName('#escapeSingleQuotes($property.name)', false, false)) ${indentation} </label> #if ("$!property.hint" != '') diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index 4b704bd4d6bd..49185db84acb 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -53,21 +53,19 @@ #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') #end {{html clean="false"}} - ## The "content" id is expected by some JavaScript and CSS code. - #set ($id = 'content') #if (!$useWysiwygEditor) <div id="xwikieditcontentinner"> ## The tool bar may have an entry to insert an HTML macro. Make sure it doesn't break the HTML macro we are currently in. #set ($toolBar = "#template('simpleedittoolbar.vm')") $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. - <textarea id="$id" cols="80" rows="25" name="$name" ## - aria-label="$escapetool.xml($services.localization.render('platform.appwithinminutes.content.edit.label'))">## + ## We want a + <textarea id="${prefix}${name}1" cols="80" rows="25" name="$name">## $escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { - 'id': "$id", + 'id': "${prefix}${name}1", 'name': "$name", 'rows': 25, 'cols': 80, diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index f3af7f06fb82..57dc6c003ab4 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -45,15 +45,14 @@ #set ($value = $xwiki.getDocument("$stringtool.removeEnd($className, 'Class')Template").title) #else ## We are editing an application entry so the title must be read from / written to the current document. - #set ($name = 'title') + #set ($name = 'title1') #set ($value = $tdoc.title) #if ("$!value" == '') #set ($value = $tdoc.documentReference.name) #end #end {{html clean="false"}} - <input type="text" name="$name" value="$!escapetool.xml($value)" - aria-label="$escapetool.xml($services.localization.render('platform.appwithinminutes.title.edit.label'))" + <input id="${prefix}$name" type="text" name="$name" value="$!escapetool.xml($value)" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml index 95589ae640da..5e7bbe533e0c 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml @@ -137,6 +137,8 @@ platform.appwithinminutes.classEditorMoveFieldLabel=Move platform.appwithinminutes.classEditorMoveFieldHint=Drag and drop to change the order platform.appwithinminutes.classEditorFieldDefaultValueToolTip=Default value +platform.appwithinminutes.classEditorFieldPrettyNameToolTip=Pretty Name +platform.appwithinminutes.classEditorFieldHintToolTip=Hint ### Date Picker platform.appwithinminutes.classEditorDatePickerAcceptSelectedDate=OK diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/less/edit.less b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/less/edit.less index 0493f92f4374..7262f270ae91 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/less/edit.less +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/less/edit.less @@ -88,10 +88,6 @@ margin-bottom: 0; } -textarea#content { - width: 100%; -} - // // Editable properties (in-place editing) // From 71292c40426bb2079c6a3875d1df37cfe15d3021 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 15:05:15 +0100 Subject: [PATCH 07/20] XWIKI-20996: AWM entry edit forms don't have labels. * Small quality improvement --- .../src/main/resources/AppWithinMinutes/Content.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index 49185db84acb..7575c44b86b7 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -53,19 +53,19 @@ #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') #end {{html clean="false"}} + #set ($id = "${prefix}${name}1") #if (!$useWysiwygEditor) <div id="xwikieditcontentinner"> ## The tool bar may have an entry to insert an HTML macro. Make sure it doesn't break the HTML macro we are currently in. #set ($toolBar = "#template('simpleedittoolbar.vm')") $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. - ## We want a - <textarea id="${prefix}${name}1" cols="80" rows="25" name="$name">## + <textarea id="$id" cols="80" rows="25" name="$name">## $escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { - 'id': "${prefix}${name}1", + 'id': "$id", 'name': "$name", 'rows': 25, 'cols': 80, From 9e02c72a58a509ac35a93439b81797cf14cc4760 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 15:06:02 +0100 Subject: [PATCH 08/20] XWIKI-20996: AWM entry edit forms don't have labels. * Small quality improvement --- .../src/main/resources/AppWithinMinutes/Content.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index 7575c44b86b7..cc83ac3c5f1a 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -60,8 +60,7 @@ #set ($toolBar = "#template('simpleedittoolbar.vm')") $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. - <textarea id="$id" cols="80" rows="25" name="$name">## - $escapetool.xml($editedDocument.content)</textarea> + <textarea id="$id" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { From 5c7cd931f606d51accb94a70e683556b1af7cc2f Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 15:23:05 +0100 Subject: [PATCH 09/20] XWIKI-20996: AWM entry edit forms don't have labels. * Removed unneeded change --- .../src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml index 8d8e5211df8b..832bd0acc612 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassSheetGenerator.xml @@ -49,7 +49,7 @@ ${indentation}<dt ${escapetool.h}if (!${escapetool.d}editing && ${esc ${indentation} class="editableProperty" ${indentation} data-property="${escapetool.d}escapetool.xml(${escapetool.d}services.model.serialize(${escapetool.d}object.getPropertyReference('#escapeSingleQuotes($property.name)')))" ${indentation} data-property-type="object"${escapetool.h}end> -${indentation} <label for="$escapetool.xml("${doc.fullName}_0_$property.name")"> +${indentation} <label${escapetool.h}if (${escapetool.d}editing) for="$escapetool.xml("${doc.fullName}_0_$property.name")"${escapetool.h}end> ${indentation} ${escapetool.d}escapetool.xml(${escapetool.d}doc.displayPrettyName('#escapeSingleQuotes($property.name)', false, false)) ${indentation} </label> #if ("$!property.hint" != '') From b6a9fb990fd323fb4e7dc9489e165108d64d5a43 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 17:00:58 +0100 Subject: [PATCH 10/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added a safety condition to the new javascript * Removed the inline label association when the input is removed. --- .../webapp/resources/uicomponents/edit/editableProperty.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index f494c5dcceb9..c2626f056652 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -131,6 +131,9 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { $(document).trigger('xwiki:dom:updated', {'elements': editor.toArray()}); // Focus the first visible input. var editInput = editor.find(':input').filter(':visible'); + // If we cannot find any kind of editInput, then we're in a weird edge case + // and we don't want to apply any of the following changes. + if(!editInput) { return; } editInput.focus(); // Make sure the edit input has an ID, and use the name of the input as a fallback if (!editInput.attr('id')) { @@ -155,11 +158,15 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { .next('.editableProperty-editor').filter(':visible').trigger('xwiki:actions:cancel').hide(); editableProperty.find('.editableProperty-save, .editableProperty-cancel').hide(); editableProperty.find('.editableProperty-edit').show(); + // Remove the for attribute from the label, resetting it to its default state + editableProperty.find('label').removeAttr('for'); }; var save = function(editableProperty) { // Disable the save and cancel actions while the property is being saved. editableProperty.find('.editableProperty-save, .editableProperty-cancel').addClass('disabled'); + // Remove the for attribute from the label, resetting it to its default state + editableProperty.find('label').removeAttr('for'); // Show progress notification message. var notification = new XWiki.widgets.Notification(l10n['core.editors.saveandcontinue.notification.inprogress'], 'inprogress'); From 2e76e371a94d193884e3422cceeec19e47bf5da0 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 19 Nov 2024 17:15:55 +0100 Subject: [PATCH 11/20] XWIKI-20996: AWM entry edit forms don't have labels. * Updated the translations --- .../src/main/resources/AppWithinMinutes/Translations.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml index 5e7bbe533e0c..436169388496 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Translations.xml @@ -46,8 +46,6 @@ platform.appwithinminutes.appsLiveTable.doc.author=Last author platform.appwithinminutes.appsLiveTable.doc.date=Update date platform.appwithinminutes.appsLiveTable._actions=Actions platform.appwithinminutes.grantSpaceAdminRightsSaveComment=Grant space administration rights. -platform.appwithinminutes.title.edit.label=Edit the title of this entry. -platform.appwithinminutes.content.edit.label=Edit the content of this entry. ### AWM Applications panel entry platform.appwithinminutes.appPanelCreateEntry=Create your own! From e805384e8881fd0e7612f6ad4b15ed70ea209b48 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 26 Nov 2024 16:39:46 +0100 Subject: [PATCH 12/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added escaping on the name used in the id for the title --- .../src/main/resources/AppWithinMinutes/Title.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index 57dc6c003ab4..0816a66acd65 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -52,7 +52,7 @@ #end #end {{html clean="false"}} - <input id="${prefix}$name" type="text" name="$name" value="$!escapetool.xml($value)" + <input id="${prefix}$escapetool.xml($name)" type="text" name="$name" value="$!escapetool.xml($value)" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end From 7cb96fcd3756b2da43f4c1da3cfc55a970462deb Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 26 Nov 2024 17:07:45 +0100 Subject: [PATCH 13/20] XWIKI-20996: AWM entry edit forms don't have labels. * Updated the content and title fields displays to use the object no. --- .../src/main/resources/AppWithinMinutes/Content.xml | 2 +- .../src/main/resources/AppWithinMinutes/Title.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index cc83ac3c5f1a..9d538a120f63 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -53,7 +53,7 @@ #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') #end {{html clean="false"}} - #set ($id = "${prefix}${name}1") + #set ($id = $escapetool.xml("${prefix}${name}")) #if (!$useWysiwygEditor) <div id="xwikieditcontentinner"> ## The tool bar may have an entry to insert an HTML macro. Make sure it doesn't break the HTML macro we are currently in. diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml index 0816a66acd65..2010fd10653c 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Title.xml @@ -39,20 +39,21 @@ {{velocity}} #if ($type == 'edit') #set ($className = $object.getxWikiClass().name) + #set ($id = $escapetool.xml("${prefix}${name}")) #if ($doc.fullName == $className) ## We are editing the class so the title must be read from / written to the template document. #set ($name = 'templateTitle') #set ($value = $xwiki.getDocument("$stringtool.removeEnd($className, 'Class')Template").title) #else ## We are editing an application entry so the title must be read from / written to the current document. - #set ($name = 'title1') + #set ($name = 'title') #set ($value = $tdoc.title) #if ("$!value" == '') #set ($value = $tdoc.documentReference.name) #end #end {{html clean="false"}} - <input id="${prefix}$escapetool.xml($name)" type="text" name="$name" value="$!escapetool.xml($value)" + <input id="$id" type="text" name="$name" value="$!escapetool.xml($value)" ## The default value for an AppWithinMinutes field should be optional so we make only the actual page title ## mandatory and not the template title, which holds the default title value. #if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end From c9a33a32cf4667d845eaca09d8a23aaac2af6215 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Tue, 26 Nov 2024 17:13:53 +0100 Subject: [PATCH 14/20] XWIKI-20996: AWM entry edit forms don't have labels. * Updated the content and title fields displays to use the object no. --- .../src/main/resources/AppWithinMinutes/Content.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index 9d538a120f63..4fa4a915e3dc 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -39,6 +39,7 @@ {{velocity}} #if ($type == 'edit') #set ($className = $object.getxWikiClass().name) + #set ($id = $escapetool.xml("${prefix}${name}")) #if ($doc.fullName == $className) ## We are editing the class so the content must be read from / written to the template document. #set ($name = 'templateContent') @@ -53,7 +54,6 @@ #set ($useWysiwygEditor = $xwiki.getUserPreference('editor') == 'Wysiwyg') #end {{html clean="false"}} - #set ($id = $escapetool.xml("${prefix}${name}")) #if (!$useWysiwygEditor) <div id="xwikieditcontentinner"> ## The tool bar may have an entry to insert an HTML macro. Make sure it doesn't break the HTML macro we are currently in. From f0a99b80e7c9c134a3228ca4e2f8ec3145195318 Mon Sep 17 00:00:00 2001 From: LucasC Date: Tue, 17 Dec 2024 18:06:14 +0100 Subject: [PATCH 15/20] XWIKI-20996: AWM entry edit forms don't have labels * Fixed escaping --- .../src/main/resources/AppWithinMinutes/Content.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml index dd6ee422cc63..51e0219af4ab 100644 --- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml +++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/Content.xml @@ -39,7 +39,7 @@ {{velocity}} #if ($type == 'edit') #set ($className = $object.getxWikiClass().name) - #set ($id = $escapetool.xml("${prefix}${name}")) + #set ($id = "${prefix}${name}") #if ($doc.fullName == $className) ## We are editing the class so the content must be read from / written to the template document. #set ($name = 'templateContent') @@ -58,7 +58,7 @@ #set ($toolBar = "#template('simpleedittoolbar.vm')") $!toolBar.replace('{{', '&#123;&#123;') ## Display a simple textarea. - <textarea id="$id" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> + <textarea id="$escapetool.xml($id)" cols="80" rows="25" name="$name">$escapetool.xml($editedDocument.content)</textarea> #end #if ($useWysiwygEditor) $!services.edit.syntaxContent.wysiwyg($editedDocument.content, $editedDocument.syntax, { From 23d77a55d416f5ed93f03c5e3f7e7f1346f8fed3 Mon Sep 17 00:00:00 2001 From: LucasC Date: Tue, 17 Dec 2024 18:07:43 +0100 Subject: [PATCH 16/20] XWIKI-20996: AWM entry edit forms don't have labels. * Fixed codestyle Co-authored-by: Michael Hamann --- .../main/webapp/resources/uicomponents/edit/editableProperty.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index c2626f056652..30e0d674395f 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -140,7 +140,7 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { editInput.attr('id', editInput.attr('name')); } // Bind the label to the newly generated edit input - editableProperty.find('label').attr('for',editInput.attr('id')); + editableProperty.find('label').attr('for', editInput.attr('id')); }).catch(() => { new XWiki.widgets.Notification(l10n['web.editableProperty.editFailed'], 'error'); return Promise.reject(); From 2ee99f1bae51ef90f88522d73ff2dba4e1400a78 Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 15 Jan 2025 10:27:48 +0100 Subject: [PATCH 17/20] XWIKI-20996: AWM entry edit forms don't have labels. * Codestyle Co-authored-by: Marius Dumitru Florea --- .../resources/uicomponents/edit/editableProperty.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index 30e0d674395f..7fae52f8bfd4 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -133,13 +133,15 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { var editInput = editor.find(':input').filter(':visible'); // If we cannot find any kind of editInput, then we're in a weird edge case // and we don't want to apply any of the following changes. - if(!editInput) { return; } + if (!editInput) { + return; + } editInput.focus(); // Make sure the edit input has an ID, and use the name of the input as a fallback if (!editInput.attr('id')) { editInput.attr('id', editInput.attr('name')); } - // Bind the label to the newly generated edit input + // Bind the label to the newly generated edit input. editableProperty.find('label').attr('for', editInput.attr('id')); }).catch(() => { new XWiki.widgets.Notification(l10n['web.editableProperty.editFailed'], 'error'); @@ -158,14 +160,14 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { .next('.editableProperty-editor').filter(':visible').trigger('xwiki:actions:cancel').hide(); editableProperty.find('.editableProperty-save, .editableProperty-cancel').hide(); editableProperty.find('.editableProperty-edit').show(); - // Remove the for attribute from the label, resetting it to its default state + // Remove the for attribute from the label, resetting it to its default state. editableProperty.find('label').removeAttr('for'); }; var save = function(editableProperty) { // Disable the save and cancel actions while the property is being saved. editableProperty.find('.editableProperty-save, .editableProperty-cancel').addClass('disabled'); - // Remove the for attribute from the label, resetting it to its default state + // Remove the for attribute from the label, resetting it to its default state. editableProperty.find('label').removeAttr('for'); // Show progress notification message. var notification = new XWiki.widgets.Notification(l10n['core.editors.saveandcontinue.notification.inprogress'], From c030a53cd0cc7a5c715f874b1c5178ac9fc13f21 Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 15 Jan 2025 17:14:28 +0100 Subject: [PATCH 18/20] XWIKI-20996: AWM entry edit forms don't have labels. * Updated the text-editor to support the new markup of the textarea. --- .../src/main/webapp/resources/js/xwiki/wikieditor/wikibits.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/wikieditor/wikibits.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/wikieditor/wikibits.js index 2593eabc1f18..aaa5c725ba2e 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/wikieditor/wikibits.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/wikieditor/wikibits.js @@ -54,7 +54,7 @@ function escapeQuotes(text) { // use sampleText instead of selection if there is none // copied and adapted from phpBB function insertTags(tagOpen, tagClose, sampleText) { - var txtarea = ($('edit') && $('edit').content) || $('content'); + var txtarea = ($('edit') && $('edit').content) || $$("textarea[name='content']"); // IE if (document.selection && !is_gecko) { From be46a71c5636266de901eba75bde717ee8ae51dc Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 15 Jan 2025 17:55:24 +0100 Subject: [PATCH 19/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added a UUID to the backup ID added for editableProperties. --- .../webapp/resources/uicomponents/edit/editableProperty.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index 7fae52f8bfd4..c017f0bb8736 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -137,9 +137,10 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { return; } editInput.focus(); - // Make sure the edit input has an ID, and use the name of the input as a fallback + // Make sure the edit input has an ID, and use the name of the input as a fallback. + // We add some random UUID to make sure we don't inadvertently collide with another ID. if (!editInput.attr('id')) { - editInput.attr('id', editInput.attr('name')); + editInput.attr('id', editInput.attr('name') + '-' + crypto.randomUUID().toString()); } // Bind the label to the newly generated edit input. editableProperty.find('label').attr('for', editInput.attr('id')); From a1d296b1af9de60cf128df3d1c5c09945158e106 Mon Sep 17 00:00:00 2001 From: LucasC Date: Thu, 16 Jan 2025 10:39:17 +0100 Subject: [PATCH 20/20] XWIKI-20996: AWM entry edit forms don't have labels. * Added a check for non secured environments --- .../webapp/resources/uicomponents/edit/editableProperty.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js index c017f0bb8736..de1bf45c51a1 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/edit/editableProperty.js @@ -140,7 +140,11 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { // Make sure the edit input has an ID, and use the name of the input as a fallback. // We add some random UUID to make sure we don't inadvertently collide with another ID. if (!editInput.attr('id')) { - editInput.attr('id', editInput.attr('name') + '-' + crypto.randomUUID().toString()); + let id = editInput.attr('name'); + if(typeof crypto?.randomUUID === "function") { + id = id + '-' + crypto.randomUUID().toString(); + } + editInput.attr('id', id); } // Bind the label to the newly generated edit input. editableProperty.find('label').attr('for', editInput.attr('id'));