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