Skip to content

Commit

Permalink
issue-1519: default disable a11y on touch devices (#1520)
Browse files Browse the repository at this point in the history
* issue-1519: default disable a11y on touch devices

* issue-1519: flipped to _isEnabledOnTouchDevices

* issue-1519: flipped to _isEnabledOnTouchDevices

* issue-1519: flipped to _isEnabledOnTouchDevices

* issue-1519: compatibility for _isDisabledOnTouchDevices
  • Loading branch information
oliverfoster authored and tomgreenfield committed May 18, 2017
1 parent 2c0204f commit be7d695
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/core/js/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ define([
//Remove button
this.$accessibilityToggle.remove();
}

if (!Modernizr.touch || this.isActive() || Adapt.config.get("_accessibility")._isDisabledOnTouchDevices) return;

var config = Adapt.config.get("_accessibility");
// Backwards compatibility for _isDisabledOnTouchDevices
var isEnabledOnTouchDevices = config._isEnabledOnTouchDevices || (config._isDisabledOnTouchDevices === false);

if (!Modernizr.touch || this.isActive() || !isEnabledOnTouchDevices) return;

//If a touch device and not enabled, remove accessibility button and turn on accessibility

Expand Down
6 changes: 3 additions & 3 deletions src/core/schema/config.model.schema
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
"title": "Enable accessibility?",
"help": "If set to 'true', accessibility features will be enabled in this course"
},
"_isDisabledOnTouchDevices": {
"_isEnabledOnTouchDevices": {
"type": "bool",
"default": "false",
"isSetting": false,
"inputType": {"type": "Boolean", "options": [true, false]},
"validators": [],
"title": "Disable accessibility on touch devices?",
"help": "If set to 'true', accessibility features will be disabled on touch devices - useful if you only need accessibility on desktop browsers."
"title": "Enable accessibility on touch devices?",
"help": "If set to 'true', accessibility features will be enabled on touch devices - useful if you need accessibility on mobile browsers."
},
"_shouldSupportLegacyBrowsers": {
"type": "bool",
Expand Down
2 changes: 1 addition & 1 deletion src/course/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"_accessibility": {
"_isEnabled": true,
"_isDisabledOnTouchDevices": false,
"_isEnabledOnTouchDevices": false,
"_shouldSupportLegacyBrowsers": true,
"_isTextProcessorEnabled": true,
"_isSkipNavigationEnabled": true
Expand Down

0 comments on commit be7d695

Please sign in to comment.