bhl-forms 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11274,7 +11274,25 @@ function getCoords(elem) {
11274
11274
  left: box2.left + window.pageXOffset
11275
11275
  };
11276
11276
  }
11277
+ function formVisible(formNode) {
11278
+ const form2 = document.getElementById(formNode.id);
11279
+ if (!form2) {
11280
+ return false;
11281
+ }
11282
+ let box2 = form2.getBoundingClientRect();
11283
+ if (box2.top < 0) {
11284
+ return false;
11285
+ }
11286
+ if (box2.bottom > (window.innerHeight || 0)) {
11287
+ return false;
11288
+ }
11289
+ return true;
11290
+ }
11277
11291
  const scrollAnchor = (formNode) => () => {
11292
+ if (formVisible(formNode)) {
11293
+ dbg("form is visible, not scrolling");
11294
+ return;
11295
+ }
11278
11296
  const anchorId = formNode.attrs.anchorElement || formNode.id;
11279
11297
  if (anchorId) {
11280
11298
  const anchor = document.getElementById(anchorId);