Skip to content

Commit 3d92b07

Browse files
committed
Add aria-label to network canvas
1 parent b0b888a commit 3d92b07

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ Array of [vis.js options](https://visjs.github.io/vis-network/docs/network/#opti
182182
| options=
183183
{
184184
"autoResize": true,
185-
"width": "50%",
186185
"nodes": {
187186
"color": "lightblue",
188187
"shape": "box",
@@ -253,6 +252,12 @@ The JavaScript tests can only be run by going to the [`Special:JavaScriptTest` p
253252

254253
## Release notes
255254

255+
### Version 1.3.0
256+
257+
Released on September 8, 2020.
258+
259+
* Added WAI compliance by adding an aria-label attribute to the network canvas
260+
256261
### Version 1.2.1
257262

258263
Released on September 7, 2020.

extension.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Network",
33

4-
"version": "1.2.0",
4+
"version": "1.3.0",
55

66
"author": [
77
"[https://www.entropywins.wtf/mediawiki Jeroen De Dauw]",
@@ -62,7 +62,8 @@
6262
"ext.network": {
6363
"dependencies": [
6464
"mediawiki.api.edit",
65-
"mediawiki.Title"
65+
"mediawiki.Title",
66+
"mediawiki.jqueryMsg"
6667
],
6768
"scripts": [
6869
"lib/vis-network.js",
@@ -77,6 +78,9 @@
7778
"styles": [
7879
"network.css"
7980
],
81+
"messages": [
82+
"network-aria"
83+
],
8084
"targets": [ "desktop", "mobile" ]
8185
}
8286
},

i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
]
77
},
88
"network-name": "Network",
9-
"network-desc": "Allows adding interactive network visualizations in your wiki pages"
9+
"network-desc": "Allows adding interactive network visualizations in your wiki pages",
10+
"network-aria": "Network visualization showing the outgoing and incoming links for {{PLURAL:$1|page|pages}} $2"
1011
}

resources/js/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
( function ( mw, netw ) {
33
"use strict"
44

5-
mw.hook( 'wikipage.content' ).add( function( $content ) {
6-
$content.find( 'div.network-visualization' ).each( function() {
7-
let $this = $( this );
5+
mw.hook('wikipage.content').add(function($content) {
6+
$content.find('div.network-visualization').each(function() {
7+
let $this = $(this);
88

99
let network = new netw.Network(
1010
$this.attr('id'),
@@ -17,7 +17,16 @@
1717
$this.data('options')
1818
);
1919

20-
network.showPages($this.data('pages'));
20+
network.showPages($this.data('pages')).then(function() {
21+
$this.find('canvas:first').attr(
22+
'aria-label',
23+
mw.message(
24+
'network-aria',
25+
$this.data('pages').length,
26+
$this.data('pages').join(', ')
27+
).parse()
28+
);
29+
});
2130
} );
2231
} );
2332

0 commit comments

Comments
 (0)