Add caption when inserting table

Data tables should always include a caption for accessibility reasons.
So add a placeholder caption when using the "insert table" button.

Bug: T252350
Change-Id: I6773e2274007946de516ae34e841f66ad20ebc0c
This commit is contained in:
pcoombe 2020-05-11 10:42:01 +01:00
parent 19520cce29
commit a822d1c197
5 changed files with 7 additions and 1 deletions

View file

@ -155,6 +155,7 @@
"wikieditor-toolbar-tool-table-example-cell-text",
"wikieditor-toolbar-tool-table-example",
"wikieditor-toolbar-tool-table-example-header",
"wikieditor-toolbar-tool-table-example-caption",
"wikieditor-toolbar-tool-table-title",
"wikieditor-toolbar-tool-table-dimensions-rows",
"wikieditor-toolbar-tool-table-dimensions-columns",

View file

@ -97,6 +97,7 @@
"wikieditor-toolbar-tool-table-example-old": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3",
"wikieditor-toolbar-tool-table-example-cell-text": "Cell text",
"wikieditor-toolbar-tool-table-example-header": "Header text",
"wikieditor-toolbar-tool-table-example-caption": "Caption text",
"wikieditor-toolbar-tool-table-title": "Insert table",
"wikieditor-toolbar-tool-table-dimensions-rows": "Rows",
"wikieditor-toolbar-tool-table-dimensions-columns": "Columns",

View file

@ -125,6 +125,7 @@
"wikieditor-toolbar-tool-table-example-old": "Used as example text when inserting a table into the editbox from the toolbar",
"wikieditor-toolbar-tool-table-example-cell-text": "[[File:Wikieditor-toolbar-tool-table.png|thumb]] See screenshot.",
"wikieditor-toolbar-tool-table-example-header": "[[File:Wikieditor-toolbar-tool-table.png|thumb]] See screenshot.\n\nSee also:\n* {{msg-mw|wikieditor-toolbar-tool-table-example-header}}\n* {{msg-mw|wikieditor-toolbar-tool-table-example}}",
"wikieditor-toolbar-tool-table-example-caption": "Used as example caption when inserting a table into the editbox from the toolbar",
"wikieditor-toolbar-tool-table-title": "[[File:Wikieditor-toolbar-tool-table.png|thumb]] See screenshot.",
"wikieditor-toolbar-tool-table-dimensions-rows": "See screenshot.\n[[File:Wikieditor-toolbar-tool-table.png|thumb]]\n{{Identical|Row}}",
"wikieditor-toolbar-tool-table-dimensions-columns": "[[File:Wikieditor-toolbar-tool-table.png|thumb]] See screenshot.\n{{Identical|Column}}",

View file

@ -832,7 +832,7 @@
width: 590,
buttons: {
'wikieditor-toolbar-tool-table-insert': function () {
var headerText, normalText, table, r, c,
var captionText, headerText, normalText, table, r, c,
isHeader, delim, classes, classStr,
rowsVal = $( '#wikieditor-toolbar-table-dimensions-rows' ).val(),
colsVal = $( '#wikieditor-toolbar-table-dimensions-columns' ).val(),
@ -854,9 +854,11 @@
alert( mw.msg( 'wikieditor-toolbar-tool-table-toomany', mw.language.convertNumber( 1000 ) ) );
return;
}
captionText = mw.msg( 'wikieditor-toolbar-tool-table-example-caption' );
headerText = mw.msg( 'wikieditor-toolbar-tool-table-example-header' );
normalText = mw.msg( 'wikieditor-toolbar-tool-table-example' );
table = '';
table += '|+ ' + captionText + '\n';
for ( r = 0; r < rows + header; r++ ) {
table += '|-\n';
for ( c = 0; c < cols; c++ ) {

View file

@ -30,6 +30,7 @@
<span rel="wikieditor-toolbar-tool-table-example"></span>
<div class="wikieditor-toolbar-table-preview-content">
<table id="wikieditor-toolbar-table-preview" class="wikieditor-toolbar-table-preview wikitable">
<caption rel="wikieditor-toolbar-tool-table-example-caption"></caption>
<thead>
<tr class="wikieditor-toolbar-table-preview-header">
<th rel="wikieditor-toolbar-tool-table-example-header"></th>