Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Error in activity reporter not visible, need to scroll to the top
Browse files Browse the repository at this point in the history
Add a scrollToMessage method for the vcd-banner-activity-reporter. This increases the visibility of success and error messages by having them in the view of the user.

Testing Done:
- Edited examples locally to have a page where the error/success message is not visible.
- Observed that the scrolling to the error/success message worked.

Signed-off-by: Juliana Sica <[email protected]>
  • Loading branch information
jsica committed Dec 4, 2023
1 parent c0d4bee commit b09499e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions projects/components/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix ErrorBannerExampleComponent when closed with X button
### Changed
* errorMessage reset value is `null` instead of `undefined`
* Add a scrollToMessage method for the vcd-banner-activity-reporter

## [15.0.1-dev.12]
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class BannerActivityReporterComponent extends ActivityReporter {
reportError(errorText: string): void {
this.errorText = errorText;
this.running = false;
this.scrollToMessage();
}

/**
Expand All @@ -59,6 +60,7 @@ export class BannerActivityReporterComponent extends ActivityReporter {
this.successMessage = successMessage;
}
this.running = false;
this.scrollToMessage();
}

/**
Expand All @@ -75,6 +77,14 @@ export class BannerActivityReporterComponent extends ActivityReporter {
this.successMessage = null;
}

/**
* To view error and success messages, scroll to the top of the page for visibility
*/
scrollToMessage(): void {
const element = document.querySelector('vcd-banner-activity-reporter');
element.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
}

/*
* Reset the banner activity state manually.
*
Expand Down

0 comments on commit b09499e

Please sign in to comment.