Skip to content

Commit

Permalink
XWIKI-22495: Missing text content in the resource picker dropdown (#3612
Browse files Browse the repository at this point in the history
)

* 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)
  • Loading branch information
Sereza7 authored Jan 28, 2025
1 parent f835854 commit 52833dc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
*/
define('resourcePickerTranslationKeys', [], [
'attach.hint',
'doc.hint'
'doc.hint',
'dropdown.toggle.title'
]);

define('resourcePicker', [
Expand All @@ -36,6 +37,7 @@ define('resourcePicker', [
'<span class="icon">' +
'</button>' +
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">' +
'<span class="sr-only"></span>' +
'<span class="caret"></span>' +
'</button>' +
'<ul class="resourceTypes dropdown-menu dropdown-menu-right"></ul>' +
Expand All @@ -48,6 +50,8 @@ define('resourcePicker', [
options = options || {};

var resourcePicker = $(resourcePickerTemplate);
resourcePicker.find('button.dropdown-toggle').attr('title', translations.get('dropdown.toggle.title'));
resourcePicker.find('button.dropdown-toggle .sr-only').text(translations.get('dropdown.toggle.title'));
resourcePicker.data("options", options);
element.on('selectResource', onSelectResource).hide().after(resourcePicker);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,23 @@ body[data-maximized="true"] {
.cke_editable.cke_show_borders table.cke_show_border &gt; tfoot &gt; tr &gt; td {
border-color: @table-border-color;
border-style: solid;
}

/* 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 environment.
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. */
.cke_reset_all .sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}</code>
</property>
<property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,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...
Expand Down

0 comments on commit 52833dc

Please sign in to comment.