Notification click not functioning

I have the following code in a cs file for razor component:

catch (Exception ex)
{
NotificationService.Notify(new NotificationMessage
{
Severity = NotificationSeverity.Error,
Summary = $"Unable to get States.",
Detail = ex.Message,
CloseOnClick = true
});
}

But the close on click does not appear and the notification closes after the elapsed time. The notification shows up. I have the notification in the main and registered and injected with DI. Do you know what I'm doing wrong?

Not sure what you expect to appear - this will just close the notification on click, there is no additional UI associated with this property.

Nothing appears, and that's okay. The notification does not wait for a click, it closes after the default time.

The idea of this property is to close the notification by clicking anywhere in the notification not just the close button.

I understand that, but the problem is that the notification closes after a period of time, not based on the click.

The last demo works normally exactly using this setting: