Skip to content

Commit c841475

Browse files
committed
TinyMCE: A11y: Remove title attributes and improve placeholders.
Shifts the `title` attribute on `more` and `page-break` placeholder images to `alt`, moves the `title` attribute to `alt` on the `style` and `script` placeholders and replaces the images to differentiate between CSS and JS content. Props sabernhardt, abcd95, joedolson. Fixes #62861. git-svn-id: https://develop.svn.wordpress.org/trunk@60007 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a179731 commit c841475

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
116116

117117
event.content = event.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
118118
return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
119-
'class="wp-more-tag mce-wp-more" alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
119+
'class="wp-more-tag mce-wp-more" alt="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
120120
});
121121
}
122122

@@ -125,7 +125,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
125125

126126
event.content = event.content.replace( /<!--nextpage-->/g,
127127
'<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
128-
'alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
128+
'alt="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
129129
}
130130

131131
if ( event.load && event.format !== 'raw' ) {
@@ -144,10 +144,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
144144
'data-wp-preserve="' + encodeURIComponent( match ) + '" ' +
145145
'data-mce-resize="false" ' +
146146
'data-mce-placeholder="1" '+
147-
'class="mce-object" ' +
147+
'class="mce-object mce-object-' + tag + '" ' +
148148
'width="20" height="20" '+
149149
'alt="&lt;' + tag + '&gt;" ' +
150-
'title="&lt;' + tag + '&gt;" ' +
151150
'/>';
152151
} );
153152
}
@@ -214,7 +213,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
214213
classname += ' mce-wp-' + tag;
215214
title = tag === 'more' ? 'Read more...' : 'Next page';
216215
title = __( title );
217-
html = '<img src="' + tinymce.Env.transparentSrc + '" alt="" title="' + title + '" class="' + classname + '" ' +
216+
html = '<img src="' + tinymce.Env.transparentSrc + '" alt="' + title + '" class="' + classname + '" ' +
218217
'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
219218

220219
// Most common case.
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

src/js/_enqueues/vendor/tinymce/skins/wordpress/wp-content.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ img[data-mce-selected]::selection {
160160
background: transparent url( images/pagebreak.png ) repeat-y scroll center center;
161161
}
162162

163+
.mce-object-style {
164+
background-image: url( images/style.svg );
165+
}
166+
167+
.mce-object-script {
168+
background-image: url( images/script.svg );
169+
}
170+
163171
/* Styles for formatting the boundaries of anchors and code elements */
164172
.mce-content-body a[data-mce-selected] {
165173
padding: 0 2px;

0 commit comments

Comments
 (0)