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

BUG: Error flashmessages do not stay on-screen in Fluid-based backend module #4672

Closed
1 task done
TheLalaMan opened this issue Nov 1, 2023 · 2 comments
Closed
1 task done
Labels

Comments

@TheLalaMan
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We have a Fluid-based backend module using a very simple layout like this:

<f:layout name="BackendSubModule"/>

<f:section name="subtitle">...</f:section>

<f:section name="content">...</f:section>

Our controller inherits from the Neos\Neos\Controller\Module\AbstractModuleController and creates flashmessages via $this->addFlashMessage('Error ...', 'MyModule', Message::SEVERITY_ERROR, [$e->getMessage()]);

I noticed that flashmessages of the type "error" disappear after 5 seconds which makes it rather hard to screenshot or copy&paste the error message that way, especially for non-technical editors.

Expected Behavior

Error flashmessages should stay on-screen and should have to be actively closed by the x button.

Steps To Reproduce

See above.

Environment

- Flow: 8.3.4
- Neos: 8.3.5
- PHP: 8.2

I checked the Git history and did not find any significant changes affecting the issue back to Neos 7, i.e. the code probably associated with this has not changed in 2 years.

Anything else?

After making sure the error was not due to anything in our codebase I did some debugging with the developer tools in FF and found out that the code responsible seems to be in located in this file:

Packages/Application/Neos.Neos/Resources/Public/JavaScript/Services/Notification.js

This module offers individual methods for creating messages with different severity levels. There is for example a dedicated error() method which sets the timeout to 0 and adds a closing button. However, that method is not called in our specific context, instead the flashmessage is rendered in the markup of the page like this

<div id="neos-notification-container" class="neos-notification-top">
    <div class="neos-notification neos-notification-error" id="neos-notification-message-1698662296">
        <i class="fas fa-error"></i>

        <div class="neos-notification-content">
            <div class="neos-notification-heading">Error ...</div>

        </div>
    </div>
</div>

and picked up by the init() method of the module (lines 82 ff). The init() method only uses a generic call to render the message (without any options)

_renderNotification(title, "", type);

which together with a default timeout of 5000 ms in the Toast component leads to the described behavior.

In conclusion, I think that the loop in the init() method could be adjusted to take into account the severity of the message and then use the dedicated other methods to render them.

@TheLalaMan
Copy link
Author

Afaik this hasn't been relased yet and so I couldn't test it yet ;-) Then I would have closed it myself.

@ahaeslich
Copy link
Member

Afaik this hasn't been relased yet and so I couldn't test it yet ;-) Then I would have closed it myself.

New bugfix releases are in progress, and as we have upmerged to the 9.0 branch, this issue has been automatically closed by github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants