Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Incorrect buttons labels in High Contrast mode #4436

Merged
merged 8 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/button/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

template += '>&nbsp;</span>' +
'<span id="{id}_label" class="cke_button_label cke_button__{name}_label" aria-hidden="false">{label}</span>' +
'<span id="{id}_description" class="cke_button_label" aria-hidden="false">{ariaShortcut}</span>' +
'<span id="{id}_description" class="cke_button_label" aria-hidden="false">{ariaShortcutSpace}{ariaShortcut}</span>' +
'{arrowHtml}' +
'</a>';

Expand Down Expand Up @@ -300,6 +300,7 @@
state: stateName,
ariaDisabled: stateName == 'disabled' ? 'true' : 'false',
title: this.title + ( shortcut ? ' (' + shortcut.display + ')' : '' ),
ariaShortcutSpace: shortcut ? '&nbsp;' : '',
ariaShortcut: shortcut ? editor.lang.common.keyboardShortcut + ' ' + shortcut.aria : '',
titleJs: env.gecko && !env.hc ? '' : ( this.title || '' ).replace( "'", '' ),
hasArrow: typeof this.hasArrow === 'string' && this.hasArrow || ( this.hasArrow ? 'true' : 'false' ),
Expand Down
12 changes: 12 additions & 0 deletions tests/plugins/button/manual/labelhc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div id="editor">
Foo Bar
</div>

<script>
CKEDITOR.on( 'instanceCreated', function( evt ) {
CKEDITOR.env.hc = true;
CKEDITOR.env.cssClass += ' cke_hc';
} );

CKEDITOR.replace( 'editor' );
</script>
11 changes: 11 additions & 0 deletions tests/plugins/button/manual/labelhc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@bender-tags: 4.15.2, 4422, bug, editor, button,
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, basicstyles, clipboard, format, stylescombo

**Note**: This test forces editor into High Contrast Mode.

1. Examine toolbar buttons.

**Expected**: There should be space between button name and keyboard shortcut.

**Unexpected**: Button keyboard shortcut description is glued to button name (no space in-between).