26
Views
4
Comments
Session Timeout Warning Triggering While User Is Active

Hi,

I'm using the Session Timeout Warning library to display a message about being logged out of the system.

It does log out of the system correctly, but the logout warning message appears even when I'm actively using the system.

In other words, it seems that the library doesn't detect that I'm clicking buttons in the system.

I'm calling this component inside the LayoutTopMenu block.

I would appreciate your help.


2025-12-09 14-11-18
Janakiraman JR

Hi Hava,

It sounds like the Session Timeout Warning library you're using isn't detecting user activity properly specifically, it's not recognizing clicks or other actions in your application as "activity." This typically happens when the library only listens for certain events (e.g., mousemove, keydown) and not others like click, scroll, or custom AJAX activity.

Check the library documentation or source code does it listen to:

  • mousemove

  • keydown

  • click

  • scroll

  • touchstart

If it's missing some, you may need to extend it or add custom handlers.

If you can share:

  • What JS framework you're using

  • Which session timeout library?

…I can give more specific code. 


UserImage.jpg
hava sh

Hi,
Thank you for your response.


I'm using this library:
https://www.outsystems.com/forge/component-overview/15965/session-timeout-warning-odc 

2025-12-09 14-11-18
Janakiraman JR

Hi Hava,

According to its docs, the library tracks last time the screen loaded, but doesn't automatically listen for user actions like clicks, scrolls, or key presses. So even though you interact with the page, the timer isn't reset unless the page reloads. 

You can reset the timer whenever user activity occurs by adding custom JavaScript:

  1. See if the component exposes a client-side method (e.g., refreshActivity()), the docs don’t say it does, but check the JavaScript API or inspect the component.

  2. Otherwise, implement your own reset logic. In web blocks, you might do:

const resetSession = () => {

  try {

    window.SessionTimeoutWarning && window.SessionTimeoutWarning.refreshActivity();

  } catch(e) { console.warn(e); }

};

['click','keydown','mousemove','scroll','touchstart'].forEach(evt =>

  document.addEventListener(evt, resetSession)

);

This ensures any interaction signals to the timeout component. 

UserImage.jpg
hava sh

So, as far as I understand,

 I will need to add this JavaScript code.

Is there an equivalent for this in OutSystems?

If not – Where is the best place to add this code?

In which block?

Thank you very much for your help!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.