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

Feature/marp 809 firefox not scroll to top after go to product detail #102

3 changes: 3 additions & 0 deletions .github/workflows/ui-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

steps:
- name: Setup chrome
uses: browser-actions/setup-chrome@v1

- name: Execute Tests
run: |
cd ./marketplace-ui
Expand Down
12 changes: 10 additions & 2 deletions marketplace-ui/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { HttpClient, provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
import { ApplicationConfig, importProvidersFrom, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { InMemoryScrollingFeature, InMemoryScrollingOptions, provideRouter, withInMemoryScrolling } from '@angular/router';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { routes } from './app.routes';
import { MARKED_OPTIONS, MarkdownModule } from 'ngx-markdown';
import { markedOptionsFactory } from './core/configs/markdown.config';
import { httpLoaderFactory } from './core/configs/translate.config';
import { apiInterceptor } from './core/interceptors/api.interceptor';

const scrollConfig: InMemoryScrollingOptions = {
scrollPositionRestoration: 'disabled',
anchorScrolling: 'disabled',
};

const inMemoryScrollingFeature: InMemoryScrollingFeature =
withInMemoryScrolling(scrollConfig);

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideRouter(routes, inMemoryScrollingFeature),
provideHttpClient(withFetch(), withInterceptors([apiInterceptor])),
importProvidersFrom(
TranslateModule.forRoot({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface DetailTab {

const STORAGE_ITEM = 'activeTab';
const DEFAULT_ACTIVE_TAB = 'description';
const SCROLL_INTERVAL = 500;
@Component({
selector: 'app-product-detail',
standalone: true,
Expand Down Expand Up @@ -103,6 +104,7 @@ export class ProductDetailComponent {
}

constructor() {
this.scrollToTop();
this.resizeObserver = new ResizeObserver(() => {
this.updateDropdownSelection();
});
Expand Down Expand Up @@ -130,6 +132,10 @@ export class ProductDetailComponent {
this.updateDropdownSelection();
}

scrollToTop() {
window.scrollTo({ left: 0, top: 0, behavior: 'instant' });
}

getProductById(productId: string): Observable<ProductDetail> {
const targetVersion =
this.routingQueryParamService.getDesignerVersionFromCookie();
Expand Down