Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-9536986-move focus to new content on Upgrade to Enhanced Recurring Donations page #7239

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
})
Loading