diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Macros.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Macros.xml
index 7a206f134a8700a5bac35da5f051c3983ca746c3..a30e619bcfc9bbeb1745defe2841f67b6ed398e0 100644
--- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Macros.xml
+++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Macros.xml
@@ -356,6 +356,10 @@
 
 #macro(displayAnnotationProperty $annotatedDocument $annotationObject $annotationProperty $mode)
   #if ($mode == 'edit' || $mode == 'create')
+    ## This startupFocus parameter is used by the CKEditor WYSIWYG editor.
+    #set ($wysiwygEditorConfig = {
+      'startupFocus': true
+    })
     ## We use displayEdit and not display('edit') because we want the input field name to be just the property name
     ## (without the "DocumentReference_objectNumber_" prefix).
     $annotatedDocument.displayEdit($annotationProperty, '', $annotationObject)
diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Script.xml b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Script.xml
index 91ff8281a396d59fac4f2c06ed4170eeba014fa4..c891c59f1b1b38e47370c36e8af19a53c739d268 100644
--- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Script.xml
+++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-ui/src/main/resources/AnnotationCode/Script.xml
@@ -1710,7 +1710,7 @@
     if (!this.safeUpdate(this.createPanel, panelContent)) {
       return;
     }
-    // set the focus in the first element of type input
+    // Set the focus in the first element of type input, useful when not using the WYSIWYG editor CKEditor.
     this.createPanel.select('form').first().focusFirstElement();
     // and add the button observers
     this.createPanel.down('input[type=submit]').observe('click', this.onAnnotationAdd.bindAsEventListener(this));
diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/EditSheet.xml b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/EditSheet.xml
index 1599c0b8c00ebc4031fb138404c329120efc8f52..586067eb5e8abbcfb10ddfc87411cbceb4a69c5a 100644
--- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/EditSheet.xml
+++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/EditSheet.xml
@@ -181,9 +181,11 @@
     }
 
     var uploadDisabled = element.hasAttribute('data-upload-disabled');
+    var startupFocus = element.hasAttribute('data-startup-focus');
 
     var config = {
       filebrowserUploadUrl: uploadDisabled ? '' : getUploadURL(sourceDocument, 'filebrowser'),
+      startupFocus,
       height: $(element).height(),
       // Used to resolve and serialize relative references. Also used to make HTTP requests with the right context.
       sourceDocument: sourceDocument,
diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/VelocityMacros.xml b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/VelocityMacros.xml
index 3b8fe12771e93b76540bd35d7cd7cae466d43cbc..74f852e991690b0941a02e96de82c25c69c52968 100644
--- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/VelocityMacros.xml
+++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/VelocityMacros.xml
@@ -174,6 +174,12 @@
   #if ($source.restricted == 'true' && !$services.security.authorization.hasAccess('edit', $source.documentReference))
     #set ($parameters.attributes.data-upload-disabled = 'true')
   #end
+  ## We use the velocity template context to convey the startupFocus parameter to CKEditor.
+  #if ($wysiwygEditorConfig.startupFocus)
+    #set ($parameters.attributes.data-startup-focus = 'true')
+    ## We make sure to clear this context so that it doesn't interfere with CKEditors opened later.
+    #set ($wysiwygEditorConfig.startupFocus = false)
+  #end
   ##
   <textarea
     #foreach ($entry in $parameters.attributes.entrySet())
diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/commentfield.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/commentfield.vm
index 03b28d534cdf33445c2bade9796dec5ca7fade14..f00fb01a22b18e2e3971cedeee5c5b8d5342d76f 100644
--- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/commentfield.vm
+++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/commentfield.vm
@@ -72,6 +72,10 @@
 
 <label for="$name">$services.localization.render('core.viewers.comments.add.comment.label')</label>
 #initRequiredSkinExtensions()
+## This startupFocus parameter is used by the CKEditor WYSIWYG editor.
+#set ($wysiwygEditorConfig = {
+  'startupFocus': true
+})
 ## display of the comment field
 $doc.displayEdit($fieldToDisplay, '', $commentObj)
 
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/viewers/comments.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/viewers/comments.js
index ce5f8d966801bae84338aee9d29260027a243524..4400d88924fe10f1dea1a5849a3ca099d32e4be7 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/viewers/comments.js
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/viewers/comments.js
@@ -599,9 +599,6 @@ viewers.Comments = Class.create({
 
     require(['jquery', 'xwiki-events-bridge'], function ($) {
       if ($(".commenteditor").length) {
-        if(typeof CKEDITOR !== 'undefined') {
-          CKEDITOR.config.startupFocus = true;
-        }
         $.post(new XWiki.Document().getURL("get") + '?' + $.param({
           xpage: 'xpart',
           vm: 'commentfield.vm',