Metronic Mega Update!Tailwind 4, React 19, Next.js 15, KtUI, ReUI, eCommerce, User Management Apps and more
Explore Update

Scroll problem on Angular Demo 5


The Demo5 template in Angular (maybe in others, I didn't check) has a problem when accessing an error screen and then going to a page where there is enough content to activate the screen scroll. The problem also occurs in the preview within the keenthemes page:

Access:
https://preview.keenthemes.com/metronic8/angular/demo5/error/404

Then access and scroll:
https://preview.keenthemes.com/metronic8/angular/demo5/apps/tickets-system/main

The problem occurs when the #kt_wrapper div has the padding-left: 225px; style more than what was already intended for the side-bar.

I use Chrome browser 130.0.6723.58 (Official Build) (x86_64) on a MacOS 15.1.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Handling scroll issues in Angular Demo 5 requires a thorough approach. I focus on debugging CSS overflow settings, ensuring smooth scrolling behavior with Angular’s built-in directives. Utilizing full stack developer course in Trivandrum event listeners and optimizing performance with virtual scrolling can significantly enhance the user experience, preventing lag and improving navigation fluidity.



I'm glad to hear it worked perfectly!

Thank you, Thiago Pires.



Hi Thiago Pires

Sorry for the delay.

we need to adjust the padding of the #kt_wrapper div when navigating from the error screen to a content-heavy page. This can be done that the padding is reset or adjusted appropriately when the sidebar is toggled or when navigating between pages.

Here’s a simplified code update to the MenuComponent.ts file, where we can add logic to handle the padding of the #kt_wrapper div:

/demo5/src/app/_metronic/kt/components/MenuComponent.ts


...
private _toggle = () => {
if (EventHandlerUtil.trigger(this.element, "kt.drawer.toggle") === false) {
return
}

if (this.shown) {
this._hide()
} else {
this._show()
}

// Adjust padding of #kt_wrapper based on sidebar visibility
const wrapper = document.getElementById("kt_wrapper");
if (wrapper) {
if (this.shown) {
wrapper.style.paddingLeft = "225px"; // Adjust as necessary
} else {
wrapper.style.paddingLeft = "0"; // Reset padding when hidden
}
}
}
...


Added logic to adjust the padding-left of the #kt_wrapper div based on whether the sidebar is shown or hidden. the padding will correctly set when navigating between pages.

Used document.getElementById to select the #kt_wrapper div and modify its style.

If it does not work, please let me know.

Thanks



Worked as a charm! Thank you, Faizal.



Hi Thiago Pires,

Apologies for the delay, and thank you for your feedback. We will investigate the issue and work on a fix. Currently, there is no available workaround, but we’ll keep you updated as soon as we have a solution.

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(