diff --git a/README.md b/README.md index 71f7fa6..1dbfc0f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ It provides visual accessibility improvements. * In order to support paragraph spacing, all body text needs to be wrapped in [paragraph tags](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p). * Font size medium is the default font size (16px usually), large is 18pt, small is 9pt. * Hide decorative images is contingent on alt text. +* No transparency removes `box-shadow` (where transparency is used), `text-shadow` and `opacity` styles. ### Theme considerations * All colour transformations are applied by mathematical shifts. It is therefore important that the course start from AA colour contrast for the algorithms to be applicable. diff --git a/js/CSSRuleModifiers.js b/js/CSSRuleModifiers.js index 7912d9c..2832d72 100644 --- a/js/CSSRuleModifiers.js +++ b/js/CSSRuleModifiers.js @@ -17,14 +17,25 @@ import Color from './Color'; */ export default [ [ - // Remove box shadows - 'box-shadow', + // Remove text shadows + 'text-shadow', null, function () { if (!this.noTransparency) return; return 'none'; } ], + [ + // Remove box shadows with transparency + 'box-shadow', + null, + function (output) { + if (!this.noTransparency) return; + const zeroOffsetAndBlur = '0px 0px 0px'; + if (output.includes(zeroOffsetAndBlur)) return; + return 'none'; + } + ], [ // Increase opacity either way 'opacity',