a11y-outline

web extension to navigate document outlines easily
git clone https://git.ce9e.org/a11y-outline.git

commit
d6b16a4cc6517344e00bbbbca76aa1e67d362cdf
parent
e974acb8e40541750bc3fb87ea2287f98de120b1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-06-03 14:43
scroll to center on focus

default behavior in chrome, but not firefox

Diffstat

M src/outline.js 6 ++++++

1 files changed, 6 insertions, 0 deletions


diff --git a/src/outline.js b/src/outline.js

@@ -10,6 +10,12 @@ var focus = function(el) {
   10    10 		el.tabIndex = -1;
   11    11 		el.focus();
   12    12 	}
   -1    13 
   -1    14 	var y = el.getBoundingClientRect().top;
   -1    15 	var h = document.documentElement.clientHeight;
   -1    16 	if (y > h / 2) {
   -1    17 		document.scrollingElement.scrollBy(0, y - h / 2);
   -1    18 	}
   13    19 };
   14    20 
   15    21 var createDialog = function() {