From d49ceb2f0c433fddb5d02e998c6d02b9c2219266 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Wed, 30 Oct 2024 16:45:31 +0100 Subject: [PATCH 1/5] XWIKI-22495: Missing text content in the resource picker dropdown * Added a translated title/content to the dropdown toggle * Updated the style to allow for the use of .sr-only in this specific context (overriding CKEditor CSS reset) --- .../main/webjar/xwiki-resource/resourcePicker.css | 12 ++++++++++++ .../src/main/webjar/xwiki-resource/resourcePicker.js | 7 +++++-- .../src/main/resources/CKEditor/Translations.xml | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css index 422a245f37a2..2efd3924ae76 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css @@ -19,6 +19,18 @@ */ #template('colorThemeInit.vm') +/* We need to redefine this class to have better priority than the CKEditor CSS reset. */ +.resourcePicker .sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} + .resourcePicker .dropdown-menu > .active > a, .resourcePicker .dropdown-menu > .active > a:hover, .resourcePicker .dropdown-menu > .active > a:focus { diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js index 6bca074cba1d..bccaa932f069 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js @@ -19,7 +19,8 @@ */ define('resourcePickerTranslationKeys', [], [ 'attach.hint', - 'doc.hint' + 'doc.hint', + 'dropdown.toggle.title' ]); define('resourcePicker', [ @@ -35,7 +36,9 @@ define('resourcePicker', [ '' + - '' + '' + diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/Translations.xml b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/Translations.xml index 489ba70ae7b5..3745da377760 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/Translations.xml +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-ui/src/main/resources/CKEditor/Translations.xml @@ -300,6 +300,7 @@ resource.user.placeholder=alias resourcePicker.attach.hint=Select an attachment resourcePicker.doc.hint=Select a page +resourcePicker.dropdown.toggle.title=Toggle the display of resource types. entityResourceSuggester.doc.placeholder=Find a page... entityResourceSuggester.attach.placeholder=Find an attachment... From edc6d87a475f5dd807727c4a1dba8b687e1840e8 Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 18 Dec 2024 11:51:02 +0100 Subject: [PATCH 2/5] XWIKI-22495: Missing text content in the resource picker dropdown * Escaped the two translations added. --- .../src/main/webjar/xwiki-resource/resourcePicker.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js index bccaa932f069..5a8f57fb7f4d 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.js @@ -36,9 +36,8 @@ define('resourcePicker', [ '' + - '' + '' + @@ -51,6 +50,8 @@ define('resourcePicker', [ options = options || {}; var resourcePicker = $(resourcePickerTemplate); + resourcePicker.find('button.dropdown-toggle').first().attr('title', translations.get('dropdown.toggle.title')); + resourcePicker.find('button.dropdown-toggle .sr-only').first().text(translations.get('dropdown.toggle.title')); resourcePicker.data("options", options); element.on('selectResource', onSelectResource).hide().after(resourcePicker); From 5c7dfef433cb5fb7d4a33544f98a7d9413106913 Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 18 Dec 2024 11:58:29 +0100 Subject: [PATCH 3/5] XWIKI-22495: Missing text content in the resource picker dropdown * Updated CSS comment --- .../src/main/webjar/xwiki-resource/resourcePicker.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css index 2efd3924ae76..6a62c884a94a 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css @@ -19,7 +19,8 @@ */ #template('colorThemeInit.vm') -/* We need to redefine this class to have better priority than the CKEditor CSS reset. */ +/* We need to redefine this class to have better priority than the CKEditor CSS reset. +Without this higher priority redefinition, the elements with this class are still shown. */ .resourcePicker .sr-only { position: absolute; width: 1px; From 3fe586fa238c28b121b473dd1da60bf2900b41d3 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 3 Jan 2025 11:39:49 +0100 Subject: [PATCH 4/5] XWIKI-22495: Missing text content in the resource picker dropdown * Updated CSS comment --- .../src/main/webjar/xwiki-resource/resourcePicker.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css index 6a62c884a94a..25f27e9d0dee 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css @@ -19,8 +19,12 @@ */ #template('colorThemeInit.vm') -/* We need to redefine this class to have better priority than the CKEditor CSS reset. -Without this higher priority redefinition, the elements with this class are still shown. */ +/* CKEditor contains a CSS reset. It works with its own style sheets and does not use the ones in XWiki. + However, we want `.sr-only` from XWiki to still be usable in our CKEditor plugins. + We need to redefine this class to have better priority than the CKEditor CSS reset. + Without this, the elements with this class are still shown + which would be different from the behaviour of `.sr-only` anywhere else in XWiki (as described in our doc). + This redefinition allows for a more consistent behaviour of the `.sr-only` class. */ .resourcePicker .sr-only { position: absolute; width: 1px; From 9bc5095a1ba9f3e246ad095ac5fba4c4037f0d3b Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 3 Jan 2025 11:42:16 +0100 Subject: [PATCH 5/5] XWIKI-22495: Missing text content in the resource picker dropdown * Updated CSS comment --- .../src/main/webjar/xwiki-resource/resourcePicker.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css index 25f27e9d0dee..e992fe3ffef3 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-resource/resourcePicker.css @@ -21,7 +21,7 @@ /* CKEditor contains a CSS reset. It works with its own style sheets and does not use the ones in XWiki. However, we want `.sr-only` from XWiki to still be usable in our CKEditor plugins. - We need to redefine this class to have better priority than the CKEditor CSS reset. + We need to redefine the XWiki styles of this class to have better priority than the CKEditor CSS reset. Without this, the elements with this class are still shown which would be different from the behaviour of `.sr-only` anywhere else in XWiki (as described in our doc). This redefinition allows for a more consistent behaviour of the `.sr-only` class. */