From 5f90075c070baec3ba6f7448866d79c08a5d6cd4 Mon Sep 17 00:00:00 2001
From: Claas Kazzer <kazzer@ub.uni-leipzig.de>
Date: Wed, 14 Mar 2018 10:50:10 +0100
Subject: [PATCH] refs #12684 * adds interim fix for aria-hidden issue on
 modals for module finc

---
 themes/finc/js/finc.js                    | 12 ++++++++++++
 themes/finc/scss/compiled.scss            |  7 +++++++
 themes/finc/templates/layout/layout.phtml | 17 +++++++++++++----
 themes/finc/theme.config.php              |  1 +
 4 files changed, 33 insertions(+), 4 deletions(-)
 create mode 100644 themes/finc/js/finc.js

diff --git a/themes/finc/js/finc.js b/themes/finc/js/finc.js
new file mode 100644
index 00000000000..c70b2c9a855
--- /dev/null
+++ b/themes/finc/js/finc.js
@@ -0,0 +1,12 @@
+// remove when fixed in BS
+
+// Remove/add aria-hidden + add modalTitle for screen-reader access
+$(document).on('shown.bs.modal', function () {
+  $('#modal').attr('aria-hidden', 'false').show();
+  $('#modal h2').attr('id', 'modalTitle');
+  $('#modal').focus(); // check if necessary!
+});
+
+$(document).on('hidden.bs.modal', function () {
+  $('#modal').attr('aria-hidden', 'true').hide();
+});
diff --git a/themes/finc/scss/compiled.scss b/themes/finc/scss/compiled.scss
index 0b60e9e3581..a6f1d3e2267 100644
--- a/themes/finc/scss/compiled.scss
+++ b/themes/finc/scss/compiled.scss
@@ -1779,6 +1779,13 @@ footer ul {
   }
 }
 
+@media (min-width: $screen-md-min) {
+  // Automatically set modal's width for larger viewports
+  .modal-dialog {
+    width: $modal-lg;
+  }
+}
+
 @media (min-width: $screen-lg-min) {
   .modal-dialog {
     max-width: em(900px);
diff --git a/themes/finc/templates/layout/layout.phtml b/themes/finc/templates/layout/layout.phtml
index e82dffac905..c6ba1d18fc8 100644
--- a/themes/finc/templates/layout/layout.phtml
+++ b/themes/finc/templates/layout/layout.phtml
@@ -51,7 +51,7 @@
         'loading' => 'Loading',
         'more' => 'more',
         'number_thousands_separator' => [
-          'number_thousands_separator', null, ','
+        'number_thousands_separator', null, ','
         ],
         'sms_success' => 'sms_success'
       ]
@@ -182,15 +182,24 @@ if (!isset($this->layout()->searchbox)) {
 
 
 <!-- MODAL IN CASE WE NEED ONE -->
-<div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">
+<? /* remove aria-hidden attr via JS, move X button to logical pos. in structure + make accessible via tab */ ?>
+<div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-modal="true" aria-labelledby="modalTitle" aria-hidden="true">
   <div class="modal-dialog">
     <div class="modal-content">
-      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
       <div class="modal-body"><?=$this->transEsc('Loading')?>&nbsp;...</div>
+      <button type="button" class="close" data-dismiss="modal" tabindex="0">
+        <span class="sr-only"><?=$this->transEsc('Close')?></span>
+        <i class="fa fa-times" aria-hidden="true"></i>
+      </button>
     </div>
   </div>
 </div>
-<div class="offcanvas-toggle" data-toggle="offcanvas"><i class="fa" title="<?=$this->transEsc('sidebar_expand')?>"></i></div>
+
+<div class="offcanvas-toggle" data-toggle="offcanvas" tabindex="0">
+  <i class="fa" title="<?=$this->transEsc('sidebar_expand')?>"></i>
+  <span class="sr-only"><?=$this->transEsc('sidebar_expand')?></span>
+</div>
+
 <div class="offcanvas-overlay" data-toggle="offcanvas"></div>
 <?=$this->googleanalytics()?>
 <?=$this->piwik()?>
diff --git a/themes/finc/theme.config.php b/themes/finc/theme.config.php
index 4ade313e43d..7dd44f1de5b 100644
--- a/themes/finc/theme.config.php
+++ b/themes/finc/theme.config.php
@@ -4,6 +4,7 @@ return array(
     'js' => array(
         'openurl.js',
         'check_item_statuses.js',
+        'finc.js',
     ),
     'helpers' => array(
         'factories' => array(
-- 
GitLab