Skip to content

Commit

Permalink
Merge pull request #7239 from SalesforceFoundation/feature/252__W-953…
Browse files Browse the repository at this point in the history
…6986-move-focus-to-new-content-on-Upgrade-to-ERD-page

W-9536986-move focus to new content on Upgrade to Enhanced Recurring Donations page
  • Loading branch information
ptewson-sfdo authored Jul 11, 2024
2 parents 7fa0bb8 + 784c9b5 commit f76a09b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
helper.handleBatchEvent(component, event, 'v.dryRunBatch');
helper.refreshDryRun(component);
helper.refreshEnable(component);
var status = event.Hp.batchProgress.status;
var dryRunJob = component.find("dryRunJob");
if (["Completed", "Aborted"].includes(status)) {
if(dryRunJob){
helper.setFocus(component, 'dryRunJob');
}
else{
helper.setFocus(component, 'dryRun2Job');
}
}
},
handleDryRunError: function (component, event, helper) {
helper.handleBatchError(component, event, 'dryRun');
Expand All @@ -44,6 +54,10 @@
handleMigrationStatusChange: function (component, event, helper) {
helper.handleBatchEvent(component, event, 'v.migrationBatch');
helper.refreshMigration(component);
var status = event.Hp.batchProgress.status;
if (["Completed", "Aborted"].includes(status)) {
helper.setFocus(component, 'migrationJob');
}
},
handleMigrationError: function (component, event, helper) {
helper.handleBatchError(component, event, 'migration');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,5 +599,22 @@
hideSpinner: function (component, element) {
var spinner = component.find(element);
$A.util.addClass(spinner, 'slds-hide');
}
},
/**
* @description: Autofocus
*/
setFocus: function (component, elementId) {
window.setTimeout(() => {
try { var element = component.find(elementId);
if (element) {
element.getElement().setAttribute('tabindex', '0');
element.getElement().focus();
element.getElement().setAttribute('tabindex', '-1');
}
} catch (error) {
console.error('Error setting focus on element:', error);

}
}, 0);
}
})

0 comments on commit f76a09b

Please sign in to comment.