@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.js CHANGED
@@ -43021,12 +43021,9 @@ var ScrollProvider = ({ children }) => {
43021
43021
  if (element && scrollViewRef.current) {
43022
43022
  const { top } = element.getBoundingClientRect();
43023
43023
  if (top < 0 || top > window.innerHeight) {
43024
- const headerHeight = getSiteHeaderHeight(scrollViewRef.current);
43025
- const wixAdHeight = getWixAdHeight();
43026
- const newTop = top + window.scrollY - 20 - headerHeight - wixAdHeight;
43027
- window.scrollTo({
43028
- top: newTop,
43029
- behavior: "smooth"
43024
+ element.scrollIntoView({
43025
+ behavior: "smooth",
43026
+ block: "center"
43030
43027
  });
43031
43028
  }
43032
43029
  }
@@ -43045,18 +43042,6 @@ function useScroll() {
43045
43042
  }
43046
43043
  return context;
43047
43044
  }
43048
- function getSiteHeaderHeight(formElement) {
43049
- const classicHeader = document.querySelector("#SITE_HEADER");
43050
- const potentialHeader = formElement.closest("main")?.previousElementSibling;
43051
- const studioHeader = potentialHeader?.tagName === "HEADER" ? potentialHeader : void 0;
43052
- const header = classicHeader || studioHeader;
43053
- const headerPosition = header && window.getComputedStyle(header).position;
43054
- return header && (headerPosition === "sticky" || headerPosition === "fixed") ? header.getBoundingClientRect().height : 0;
43055
- }
43056
- function getWixAdHeight() {
43057
- const ad = document.querySelector("#WIX_ADS");
43058
- return ad && window.getComputedStyle(ad).position === "fixed" ? ad.getBoundingClientRect().height : 0;
43059
- }
43060
43045
 
43061
43046
  // ../form-fields/dist/esm/contexts/translation-context.js
43062
43047
  var TranslationContext = createContext(void 0);