Skip to content

Commit

Permalink
tab order and alt text amends
Browse files Browse the repository at this point in the history
- insert button immediately after back button (so that tab order is correct).
- add button alt text.
- indent example json.
  • Loading branch information
kirsty-hames committed Nov 18, 2019
1 parent b0e266f commit 2e7159b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "git://github.com/cgkineo/adapt-homeButton.git"
},
"framework": ">=2.0.18",
"version": "0.0.7",
"version": "0.0.8",
"homepage": "https://github.com/cgkineo/adapt-homeButton",
"displayName": "Home Button",
"extension": "homeButton",
Expand Down
35 changes: 18 additions & 17 deletions example.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// config.json
"_homeButton": {
"_isEnabled": true
}
// config.json
"_homeButton": {
"_isEnabled": true
}

// course.json
"_homeButton": {
"_isEnabled": false,
"_hideHomeButton": false,
"_redirectToId": ""
}
// course.json
"_homeButton": {
"_isEnabled": false,
"_hideHomeButton": false,
"_redirectToId": "",
"alt": "Home"
}

// contentObjects.json
"_homeButton": {
"_isEnabled": false,
"_hideHomeButton": false,
"_hideBackButton": false,
"_redirectToId": ""
}
// contentObjects.json
"_homeButton": {
"_isEnabled": false,
"_hideHomeButton": false,
"_hideBackButton": false,
"_redirectToId": ""
}
18 changes: 14 additions & 4 deletions js/adapt-homeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@ define([
},

_createHomeButton: function() {
$('.navigation-inner').append($('<button>', {
attr: { 'data-event': 'homeButton' },
'class': 'base navigation-home-button icon icon-home'
}));
var config = Adapt.course.get("_homeButton");
var altText = (config && config.alt);
var $backButton = $('button[data-event="backButton"]');
var $homeButton = $('<button>', {
attr: {
'data-event': 'homeButton'
},
'class': 'base navigation-home-button icon icon-home',
'aria-label': altText
});

// insert immediately after back button (so that tab order is correct)
// back button is part of core (navigation.hbs)
$homeButton.insertAfter($backButton);
},

_redirected: function() {
Expand Down
9 changes: 9 additions & 0 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@
"title": "Redirect the home button to id",
"inputType": "Text",
"validators": []
},
"alt": {
"type": "string",
"required": false,
"default": "Home",
"title": "Home button alt text",
"inputType": "Text",
"validators": [],
"translatable": true
}
}
}
Expand Down

0 comments on commit 2e7159b

Please sign in to comment.