diff --git a/example.json b/example.json index 9a7c37c..62afcab 100644 --- a/example.json +++ b/example.json @@ -3,6 +3,7 @@ "_close": { "_navOrder": 110, "navLabel": "Close", + "ariaLabel": "Select here to close the course.", "_navTooltip": { "_isEnabled": true, "text": "Close" @@ -16,7 +17,6 @@ "_button": { "_isEnabled": true, "_closeViaLMSFinish": false, - "navigationAriaLabel": "Close course button", "_notifyPromptIfIncomplete": { "_isEnabled": false, "title": "Confirm close", diff --git a/js/CloseNavigationButtonView.js b/js/CloseNavigationButtonView.js index 8f6238d..20b9a47 100644 --- a/js/CloseNavigationButtonView.js +++ b/js/CloseNavigationButtonView.js @@ -4,16 +4,10 @@ import tooltips from 'core/js/tooltips'; import notify from 'core/js/notify'; export default class CloseNavigationButtonView extends NavigationButtonView { - attributes() { - const attributes = this.model.toJSON(); return { - name: attributes._id, - role: attributes._role === 'button' ? undefined : attributes._role, - 'aria-label': Adapt.adaptclose.config._button.navigationAriaLabel, - 'data-order': attributes._order, - 'data-tooltip-id': 'adaptclose', - 'data-event': 'closeButton' + ...super.attributes(), + 'data-tooltip-id': 'adaptclose' }; } diff --git a/js/adapt-close.js b/js/adapt-close.js index 5048cd6..8a9408b 100644 --- a/js/adapt-close.js +++ b/js/adapt-close.js @@ -11,7 +11,6 @@ class AdaptClose extends Backbone.Controller { this.listenToOnce(Adapt, 'adapt:start', this.onStart); } - get config () { return Adapt.course.get('_close'); } @@ -49,7 +48,8 @@ class AdaptClose extends Backbone.Controller { const { _navOrder = 100, _showLabel = true, - navLabel = '' + navLabel = '', + ariaLabel = '' } = AdaptClose.globalsConfig ?? {}; const model = new NavigationButtonModel({ @@ -59,7 +59,9 @@ class AdaptClose extends Backbone.Controller { _classes: 'btn-icon nav__btn nav__close-btn', _iconClasses: '', _role: 'button', + ariaLabel, text: navLabel, + _event: 'closeButton', config: this.config }); diff --git a/properties.schema b/properties.schema index 409a0b9..19de8a2 100644 --- a/properties.schema +++ b/properties.schema @@ -3,9 +3,9 @@ "$schema": "http://json-schema.org/draft-03/schema", "id": "http://jsonschema.net", "globals": { - "closeButton": { + "ariaLabel": { "type": "string", - "default": "Select here to close the window.", + "default": "Select here to close the course.", "title": "Close button ARIA label", "inputType": "Text", "translatable": true @@ -85,14 +85,6 @@ "inputType": "Checkbox", "help": "Enables closing the course via the SCORM 'finish' function rather than by closing the window - useful for LMSes that don't open the course in a new window or don't allow the course window to be closed via JavaScript." }, - "navigationAriaLabel": { - "type": "string", - "default": "Close course button", - "title": "Navigation button alt text", - "inputType": "Text", - "required": true, - "translatable": true - }, "_notifyPromptIfIncomplete": { "type": "object", "title": "Notify prompt if incomplete", diff --git a/schema/course.schema.json b/schema/course.schema.json index 29fba19..633ca90 100644 --- a/schema/course.schema.json +++ b/schema/course.schema.json @@ -21,10 +21,10 @@ "title": "Close", "default": {}, "properties": { - "closeButton": { + "ariaLabel": { "type": "string", "title": "Close button ARIA label", - "default": "Select here to close the window.", + "default": "Select here to close the course.", "_adapt": { "translatable": true } @@ -95,14 +95,6 @@ "description": "Enables closing the course via the SCORM 'finish' function rather than by closing the window - useful for LMSes that don't open the course in a new window or don't allow the course window to be closed via JavaScript.", "default": false }, - "navigationAriaLabel": { - "type": "string", - "title": "Navigation button alt text", - "default": "Close course button", - "_adapt": { - "translatable": true - } - }, "_notifyPromptIfIncomplete": { "type": "object", "title": "Notify prompt if incomplete",