diff --git a/CHANGELOG.md b/CHANGELOG.md
index 182f163..4bf62de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,12 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
+## 1.3.2
+
+**Changed**
+
+* The SVG Sprite is no longer hidden with `display:none` and instead visually hidden and moved offscreen (#49)
+
## 1.3.1
* Check for array key before using when preloading assets (#47).
diff --git a/asset-manager.php b/asset-manager.php
index 9168cdf..03df339 100644
--- a/asset-manager.php
+++ b/asset-manager.php
@@ -10,7 +10,7 @@
Plugin URI: https://github.com/alleyinteractive/wp-asset-manager
Description: Add more robust functionality to enqueuing static assets
Author: Alley Interactive
-Version: 1.2.0
+Version: 1.3.2
License: GPLv2 or later
Author URI: https://www.alleyinteractive.com/
*/
diff --git a/php/class-asset-manager-svg-sprite.php b/php/class-asset-manager-svg-sprite.php
index d3e34e7..81e7946 100644
--- a/php/class-asset-manager-svg-sprite.php
+++ b/php/class-asset-manager-svg-sprite.php
@@ -142,7 +142,10 @@ public function setup() {
add_filter(
'safe_style_css',
function( $styles ) {
- $styles[] = 'display';
+ $styles[] = 'left';
+ $styles[] = 'overflow';
+ $styles[] = 'position';
+ $styles[] = 'visibility';
return $styles;
}
);
@@ -157,7 +160,14 @@ public function create_sprite_sheet() {
$this->sprite_document = new DOMDocument();
$this->svg_root = $this->sprite_document->createElementNS( 'http://www.w3.org/2000/svg', 'svg' );
- $this->svg_root->setAttribute( 'style', 'display:none' );
+
+ $this->svg_root->setAttribute( 'style', 'left:-9999px;overflow:hidden;position:absolute;visibility:hidden' );
+
+ $this->svg_root->setAttribute( 'focusable', 'false' );
+ $this->svg_root->setAttribute( 'height', '0' );
+ $this->svg_root->setAttribute( 'role', 'none' );
+ $this->svg_root->setAttribute( 'viewBox', '0 0 0 0' );
+ $this->svg_root->setAttribute( 'width', '0' );
$this->sprite_document->appendChild( $this->svg_root );
diff --git a/php/kses-svg.php b/php/kses-svg.php
index bd3805d..a238b9f 100644
--- a/php/kses-svg.php
+++ b/php/kses-svg.php
@@ -867,6 +867,7 @@
),
'svg' => array_merge(
[
+ 'focusable' => true,
'height' => true,
'preserveaspectratio' => true,
'viewbox' => true,
diff --git a/tests/test-sprite.php b/tests/test-sprite.php
index 679b027..c14c59b 100644
--- a/tests/test-sprite.php
+++ b/tests/test-sprite.php
@@ -4,7 +4,7 @@
class Asset_Manager_Sprite_Tests extends Asset_Manager_Test {
- public $empty_sprite_wrapper = '';
+ public $empty_sprite_wrapper = '';
/**
* Note: These aren't stright copies of SVG contents; they have been modified