From b3c40a33cbea83fb5cf4a8dafb91fa3f96805db5 Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Thu, 10 Dec 2020 10:44:54 +0100 Subject: [PATCH] refs #18034 [finc] inform screen readers about changes in cart * set aria-live to polite * set aria-atomic to true --- themes/finc/js/cart-finc.js | 8 ++++++++ themes/finc/theme.config.php | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 themes/finc/js/cart-finc.js diff --git a/themes/finc/js/cart-finc.js b/themes/finc/js/cart-finc.js new file mode 100644 index 00000000000..fc1ddd56c9e --- /dev/null +++ b/themes/finc/js/cart-finc.js @@ -0,0 +1,8 @@ +/* #18034 - inform screen reader about changes, eventually intregrate by PR into bootstrap cart.js - RL */ +$(document).ready(function() { + var cart = document.getElementById("cartSummary"); + if (cart !== undefined) { + cart.setAttribute("aria-live", "polite"); + cart.setAttribute("aria-atomic", "true"); + } +}); diff --git a/themes/finc/theme.config.php b/themes/finc/theme.config.php index c427cbde51c..3896a57fa8b 100644 --- a/themes/finc/theme.config.php +++ b/themes/finc/theme.config.php @@ -5,7 +5,8 @@ return [ 'check_item_statuses.js', 'lightbox_form_cache.js', 'covers.js', - 'common-finc.js' + 'common-finc.js', + 'cart-finc.js' ], 'helpers' => [ 'aliases' => [ -- GitLab