@mxenabled/connect-widget 0.15.1 → 0.15.2

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.es.js CHANGED
@@ -76183,6 +76183,33 @@ const ManualAccountForm = React__default.forwardRef(
76183
76183
  });
76184
76184
  return schema;
76185
76185
  }
76186
+ useEffect(() => {
76187
+ const handleFocus = (event) => {
76188
+ const focusedElement = event.target;
76189
+ if (formRef.current && focusedElement !== null) {
76190
+ const containerRect = formRef.current.getBoundingClientRect();
76191
+ const elementRect = focusedElement.getBoundingClientRect();
76192
+ const stickyHeader = document.querySelector(
76193
+ '[data-test="navigation-header"]'
76194
+ );
76195
+ const stickyHeaderHeight = stickyHeader ? stickyHeader.offsetHeight : 0;
76196
+ if (elementRect.top < containerRect.top + stickyHeaderHeight || // Account for sticky header
76197
+ elementRect.bottom > containerRect.bottom) {
76198
+ focusedElement.scrollIntoView({
76199
+ behavior: "smooth",
76200
+ block: "center"
76201
+ });
76202
+ if (stickyHeaderHeight > 0) {
76203
+ window.scrollBy(0, -stickyHeaderHeight);
76204
+ }
76205
+ }
76206
+ }
76207
+ };
76208
+ formRef.current?.addEventListener("focusin", handleFocus);
76209
+ return () => {
76210
+ formRef.current?.addEventListener("focusin", handleFocus);
76211
+ };
76212
+ }, [formRef]);
76186
76213
  useEffect(() => {
76187
76214
  if (!saving) return () => {
76188
76215
  };