Title: RouterLinkActive scroll to visible · Issue #24404 · angular/angular · GitHub
Open Graph Title: RouterLinkActive scroll to visible · Issue #24404 · angular/angular
X Title: RouterLinkActive scroll to visible · Issue #24404 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [x] Feature request [ ] Documentation issue or request [ ] Support request => Please do not submi...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [x] Feature request [ ] Documentation issue or request [ ...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [x] Feature request [ ] Documentation issue or reques...
Opengraph URL: https://github.com/angular/angular/issues/24404
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RouterLinkActive scroll to visible","articleBody":"## I'm submitting a...\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ ] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[x] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\nRouterLinkActive not visible on long List without scroll.\r\n\r\n\r\n## Expected behavior\r\nMake a RouterLinkActive visible, scroll if needed on long List for example.\r\n\r\n\r\n## What is the motivation / use case for changing the behavior?\r\nRouterLinkActive not visible on long List or Table until you scroll on element.\r\n\r\n\r\n## Environment\r\nAngular version: 6.0.4\r\n\r\n## Others:\r\nCurrent temp workaround:\r\n```ts\r\nimport { Directive, AfterContentInit, OnDestroy, ElementRef, ContentChild } from '@angular/core';\r\nimport { Router, RouterLinkActive, NavigationEnd } from '@angular/router';\r\nimport { Subscription } from 'rxjs';\r\nimport { filter } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[routerLinkActiveVisible]'\r\n})\r\nexport class RouterLinkActiveVisibleDirective implements AfterContentInit, OnDestroy {\r\n private readonly subscription: Subscription;\r\n\r\n @ContentChild(RouterLinkActive) private link: RouterLinkActive;\r\n \r\n constructor(\r\n private readonly elementRef: ElementRef,\r\n private readonly router: Router) {\r\n this.subscription = this.router.events.pipe(\r\n filter(e => e instanceof NavigationEnd))\r\n .subscribe(\r\n () => {\r\n this.updateScroll();\r\n });\r\n }\r\n\r\n ngAfterContentInit(): void {\r\n this.updateScroll();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.subscription.unsubscribe();\r\n }\r\n\r\n private updateScroll() {\r\n if (!this.link || !this.link.links || !this.link.linksWithHrefs || !this.router.navigated)\r\n return;\r\n\r\n const isActive = (this.link as any).hasActiveLinks(); // TODO Fix this HACK\r\n if (isActive) {\r\n this.elementRef.nativeElement[\"scrollIntoViewIfNeeded\"]();\r\n }\r\n }\r\n}\r\n```","author":{"url":"https://github.com/YZahringer","@type":"Person","name":"YZahringer"},"datePublished":"2018-06-10T18:21:37Z","url":"https://github.com/angular/angular/issues/24404"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ed4aa5bb-a42b-7633-b735-60139eddcdba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2CA:213839:1FF3A9B:28D4733:6B015E75 |
| html-safe-nonce | 35ecf9b1d7899c9c82ac95a5c19d73df5f7def0405c148bf9b694047054bbd01 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkNBOjIxMzgzOToxRkYzQTlCOjI4RDQ3MzM6NkIwMTVFNzUiLCJ2aXNpdG9yX2lkIjoiOTY0ODMzMjM5NTM2MzQ5MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dcf0e476b2968fcbc7804207d42a69cc8c848dc540d2b38abeedc456d8055a9b |
| hovercard-subject-tag | issue:330990740 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/24404/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c72bcdbaac64c233ca3e8a7cd9c61c867063bab6e823a751f77776158ceeecb4/angular/angular/issues/24404 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c72bcdbaac64c233ca3e8a7cd9c61c867063bab6e823a751f77776158ceeecb4/angular/angular/issues/24404 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [x] Feature request [ ] Documentation issue or request [ ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | YZahringer |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width