From 46928263c20b77e8d9fb3e9c3d6281640bc7d5cd Mon Sep 17 00:00:00 2001 From: appel Date: Fri, 25 Feb 2022 11:27:06 -0500 Subject: [PATCH] Hide tooltips via ESC key Please excuse the hacky way I did this! I'm not super well versed in jQuery plugin development, nor am I very familiar with git, unfortunately. But this seems to work and solved my issue, so I figured I'd share in case it's useful. Added an option to hide tooltips via the ESC key. As I understand it this is a requirement for Success Criterion 1.4.13 of WACG 2.1, I needed this for an project. --- dist/zebra_tooltips.src.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dist/zebra_tooltips.src.js b/dist/zebra_tooltips.src.js index de6ea58..c6e85e4 100644 --- a/dist/zebra_tooltips.src.js +++ b/dist/zebra_tooltips.src.js @@ -229,6 +229,13 @@ if (title) $(this).attr('title', title); }); + + // hide tooltip when ESC is pressed + $element.on('keyup', function (e) { + if (e.key === 'Escape') { + _hide($element); + } + }); // initialize and cache tooltip data $element.data('Zebra_Tooltip', $.extend({