@wix/form-public 0.508.0 → 0.509.0

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.
package/dist/index.cjs CHANGED
@@ -43031,12 +43031,9 @@ var ScrollProvider = ({ children }) => {
43031
43031
  if (element && scrollViewRef.current) {
43032
43032
  const { top } = element.getBoundingClientRect();
43033
43033
  if (top < 0 || top > window.innerHeight) {
43034
- const headerHeight = getSiteHeaderHeight(scrollViewRef.current);
43035
- const wixAdHeight = getWixAdHeight();
43036
- const newTop = top + window.scrollY - 20 - headerHeight - wixAdHeight;
43037
- window.scrollTo({
43038
- top: newTop,
43039
- behavior: "smooth"
43034
+ element.scrollIntoView({
43035
+ behavior: "smooth",
43036
+ block: "center"
43040
43037
  });
43041
43038
  }
43042
43039
  }
@@ -43055,18 +43052,6 @@ function useScroll() {
43055
43052
  }
43056
43053
  return context;
43057
43054
  }
43058
- function getSiteHeaderHeight(formElement) {
43059
- const classicHeader = document.querySelector("#SITE_HEADER");
43060
- const potentialHeader = formElement.closest("main")?.previousElementSibling;
43061
- const studioHeader = potentialHeader?.tagName === "HEADER" ? potentialHeader : void 0;
43062
- const header = classicHeader || studioHeader;
43063
- const headerPosition = header && window.getComputedStyle(header).position;
43064
- return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
43065
- }
43066
- function getWixAdHeight() {
43067
- const ad = document.querySelector("#WIX_ADS");
43068
- return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
43069
- }
43070
43055
 
43071
43056
  // ../form-fields/dist/esm/contexts/translation-context.js
43072
43057
  var TranslationContext = React172.createContext(void 0);