Skip to content

Commit

Permalink
Merge pull request #93 from estebancastro/patch-3
Browse files Browse the repository at this point in the history
Update tab-handler.twig
  • Loading branch information
khalwat committed Jun 27, 2024
2 parents 364e3db + aa816b6 commit 1d2e7c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cms/templates/_boilerplate/_partials/tab-handler.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{# -- Handle tabs gracefully as per https://hackernoon.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2 -- #}
{# -- Handle tabs gracefully as per https://david-gilbertson.medium.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2 -- #}
<style>
body:not(.user-is-tabbing) button:focus,
body:not(.user-is-tabbing) input:focus,
Expand All @@ -10,15 +10,15 @@
<script>
function handleFirstTab(e) {
if (e.keyCode === 9) {
document.body.classList.add('user-is-tabbing');
document.documentElement.classList.add('user-is-tabbing');
window.removeEventListener('keydown', handleFirstTab);
window.addEventListener('mousedown', handleMouseDownOnce);
}
}
function handleMouseDownOnce() {
document.body.classList.remove('user-is-tabbing');
document.documentElement.classList.remove('user-is-tabbing');
window.removeEventListener('mousedown', handleMouseDownOnce);
window.addEventListener('keydown', handleFirstTab);
Expand Down

0 comments on commit 1d2e7c3

Please sign in to comment.