bhl-forms 0.0.45 → 0.0.46

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.
@@ -11184,16 +11184,26 @@ function prepData(formData) {
11184
11184
  };
11185
11185
  return data;
11186
11186
  }
11187
- const isMobile = window.matchMedia("only screen and (max-width: 480px)").matches;
11187
+ window.matchMedia("only screen and (max-width: 480px)").matches;
11188
+ function getCoords(elem) {
11189
+ let box2 = elem.getBoundingClientRect();
11190
+ return {
11191
+ top: box2.top + window.pageYOffset,
11192
+ right: box2.right + window.pageXOffset,
11193
+ bottom: box2.bottom + window.pageYOffset,
11194
+ left: box2.left + window.pageXOffset
11195
+ };
11196
+ }
11188
11197
  const fireStepEvent = (formNode) => (stepResult, stepHistory2, stepQueue2) => {
11189
11198
  if (!stepResult) {
11190
11199
  return;
11191
11200
  }
11192
11201
  const anchorId = formNode.attrs.anchorElement || formNode.id;
11193
- if (anchorId && isMobile) {
11202
+ if (anchorId) {
11194
11203
  const anchor = document.getElementById(anchorId);
11195
11204
  if (anchor) {
11196
- anchor.scrollIntoView(true);
11205
+ const pos = getCoords(anchor);
11206
+ window.scrollTo(pos.right, pos.top);
11197
11207
  }
11198
11208
  }
11199
11209
  var step_values = null;