Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0035552mantisbtuipublic2025-03-22 00:36
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Target Version2.28.0Fixed in Version2.28.0 
Summary0035552: Inline error messages are sometimes displayed behind the navbar
Description

This causes the first such warning to be impossible to read without using the browser's developer tools.

@raspopov proposed a fix for this in PR 2115 which displays the div with a relative position shifted down, but the solution has a negative side-effect as it also shifts the warnings when they are occurring later on the page (see screenshot).

3 alternatives are discussed in the PR

  • Add the style z-index: 10000, then the element will be on top and overlap the others.
  • Define a default constant: define( 'DELAY_INLINE_ERROR_REPORTING', true ); so that all errors go to the delayed messages panel.
  • Add a mechanism to keep track of when the page title is printed, and elements before the navbar should be printed with position: relative, and after - without.
TagsNo tags attached.
Attached Files
image.png (93,373 bytes)   
image.png (93,373 bytes)   

Relationships

related to 0035207 resolveddregad Early inline warnings mess up with page layout 
related to 0035583 resolveddregad Delayed inline errors are not printed on login page 

Activities

dregad

dregad

2025-03-08 08:24

developer   ~0069967

Add the style z-index: 10000, then the element will be on top and overlap the others.

I don't much like this idea to be honest.

Define a default constant: define( 'DELAY_INLINE_ERROR_REPORTING', true ); so that all errors go to the delayed messages panel.

The purpose of these inline warnings is to help catching minor issues such as deprecation notices during development. The idea is to have them printed visually close to where they are triggered. Of course this is somewhat unnecessary, because we also have the line number printed with the message, but I kind of like it.

If we always set the constant to true, then we lose this. But then we don't need the conditional display in error_handler() anymore as they would always be delayed.

Add a mechanism to keep track of when the page title is printed, and elements before the navbar should be printed with position: relative, and after - without.

The DELAY_INLINE_ERROR_REPORTING constant was introduced in PR 2066 to fix 0035207, which is basically the same issue / root cause as this, but the fix only covered a few use cases (e.g. plugin initialisation).

We could probably adapt and generalize the existing mechanism to achieve that - instead of calling error_delay_reporting() when we (think we) need it, do it systematically as part of layout API.

raspopov

raspopov

2025-03-08 08:39

reporter   ~0069968

The idea is to have them printed visually close to where they are triggered.

How about doing both? Print both inline and pending messages? (perhaps with an indication that it's a duplicate).

dregad

dregad

2025-03-08 09:13

developer   ~0069969

What is the added value of printing the same error twice ?

dregad

dregad

2025-03-08 09:30

developer   ~0069970

Draft PR: https://github.com/mantisbt/mantisbt/pull/2120

At this point, the PR is just a cherry-pick of @raspopov's proposed fix.

dregad

dregad

2025-03-15 10:45

developer   ~0069994

I decided to replace the DELAY_INLINE_ERROR_REPORTING constant by a global variable, to give more flexibility as to when inline warnings should be delayed or not.

PR https://github.com/mantisbt/mantisbt/pull/2120 updated and ready for review.

Testing and feedback is welcome.

Related Changesets

MantisBT: master 9dfb34b9

2025-03-15 10:32

dregad


Details Diff
Fix inline warnings showing behind navbar

Improves the delayed printing mechanism implemented in 0035207, replacing
the DELAY_INLINE_ERROR_REPORTING constant by a global variable
($g_errors_delay_reporting), allowing to switch delayed reporting on and
off as needed.

Reporting is delayed by default, and Layout API (layout_page_begin())
switches it off when the page header has been displayed.

Fixes 0035552
Affected Issues
0035552
mod - core/error_api.php Diff File
mod - core/layout_api.php Diff File

MantisBT: master 8dd060a2

2025-03-16 05:18

dregad


Details Diff
Display errors triggered after delayed printing

When delayed reporting is on, an inline error triggered after delayed
errors have been printed will not be displayed.

To avoid that, set $g_error_delay_reporting = false at the end of
error_print_delayed().

Fixes 0035552
Affected Issues
0035552
mod - core/error_api.php Diff File