Skip to content

Commit

Permalink
CSS: Hide collapsed sections when JS is disabled
Browse files Browse the repository at this point in the history
What is wrong with the collapse_api semantics:
JS writes the collapse state in a cookie; the server retrieves it to
display each section in the proper state. The classes 'collapse_closed'
and 'collapse_open' may be reversed, causing a collapsed section to have
class 'collapse_open'... wtf?

This commit fixes the problem by creating a new class to identify which
section is the collapsed one. This new class is not affected by
javascript, and hidden by default using CSS.

Fixes #19508

Signed-off-by: Damien Regad <dregad@mantisbt.org>

Changes from cproensa's original commits:
- squashed
- commit message reworded
- CSS rule on a single line
  • Loading branch information
cproensa authored and dregad committed Oct 27, 2015
1 parent 9fcdd06 commit 9674df6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/collapse_api.php
Expand Up @@ -110,7 +110,7 @@ function collapse_closed( $p_name, $p_section = '' ) {
ob_start();

$t_div_id = $t_block . '_closed';
echo "\n<div id=\"", $t_div_id, '"', ( $t_display ? ' class="collapse-open"' : ' class="collapse-closed"' ), '>';
echo "\n<div id=\"", $t_div_id, '" class="collapse-section-closed ', ( $t_display ? 'collapse-open' : 'collapse-closed' ), '">';
}

/**
Expand Down
3 changes: 3 additions & 0 deletions css/default.css
Expand Up @@ -804,3 +804,6 @@ div.timeline * div.action { padding-top: 3px; }
/* bug_view_inc bug action buttons */
.details-footer { padding: 3px 10px 2px 0; }
.details-buttons { float: left; width: auto; }

/* Hide collapsed sections for javascript disabled presentation */
.collapse-section-closed { display: none; }

0 comments on commit 9674df6

Please sign in to comment.