@hubsync/esign-web-sdk 6.5.9 → 6.5.10

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.
@@ -137,8 +137,9 @@ const VerdocsSign = class {
137
137
  this.processAuthResponse(response);
138
138
  const fillable = this.getSortedFillableFields();
139
139
  if (fillable.length > 0) {
140
+ // Give the document a moment to render, then focus and highlight the first fillable field
140
141
  setTimeout(() => {
141
- this.focusedField = fillable[0].name;
142
+ this.focusField(fillable[0]);
142
143
  }, 500);
143
144
  }
144
145
  }
@@ -501,12 +502,22 @@ const VerdocsSign = class {
501
502
  }
502
503
  focusField(field, scrollInline = 'center') {
503
504
  var _a;
504
- if (!field)
505
+ // Clear any previously highlighted field
506
+ const previousActive = document.querySelector('.verdocs-active-field');
507
+ if (previousActive) {
508
+ previousActive.classList.remove('verdocs-active-field');
509
+ }
510
+ if (!field) {
511
+ this.focusedField = '';
505
512
  return;
513
+ }
506
514
  const id = getFieldId(field);
507
515
  const el = document.getElementById(id);
508
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: scrollInline });
509
- (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
516
+ if (el) {
517
+ el.classList.add('verdocs-active-field');
518
+ el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: scrollInline });
519
+ (_a = el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
520
+ }
510
521
  this.focusedField = field.name;
511
522
  this.markFieldVisited(field.name);
512
523
  this.checkRecipientFields();