Loading...
 
Skip to main content

Display of collapsible sections ("+"/"-" headers) in FADE zones broken

Status
Open
Subject
Display of collapsible sections ("+"/"-" headers) in FADE zones broken
Version
15.x
19.x
9.x
Category
  • Conflict of two features (each works well independently)
Feature
Wiki Plugin (extends basic syntax)
Wiki Syntax (text area, parser, external wiki, etc)
Resolution status
New
Submitted by
Philippe Cloutier
Lastmod by
Philippe Cloutier
Rating
(0)
Description

Collapsible sections are those created by starting a title with "+" or "-". Some of these sections cannot be expanded or collapsed due to a conflict with other collapsible sections shown at the same time but parsed in different contexts.

When such a conflict happens, the div elements of the conflicting sections have identical id attributes (which means the HTML is invalid). Browsers deal with such conflicts by considering that the real element with the duplicate id is the first one. Consequently, when that happens, trying to open/close any of the conflicting sections will open/close the first conflicting section.

It would be difficult to explain exactly when this occurs or not, but this is very simple to reproduce. Suffice to call the FADE plugin twice and to have at least 1 collapsible section in each call's body. Trying to open or close the first section of the second call to FADE will fail.

Cause

The identifiers of the section are generated in parse_data_process_maketoc(). The $nb_hdrs variable holds a count of collapsible sections which attempts to avoid such conflicts, but as this is a local variable, when parse_data_process_maketoc() is called several times, conflicts can occur between different contexts. As FADE calls parse_data() to parse its body, a page's immediate content and its content inside a FADE zone are parsed in different contexts.

This affects trunk as of r69061.

Example

This is demonstrated on this show.tikiwiki.org page.

Solution
This can be solved either by making $nb_hdrs a global variable, or by using jQuery to select the first div element which follows the clicked toggle.
Importance
3
Easy to solve?
6
Priority
18
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
7031
Created
Monday 18 February, 2019 22:58:50 UTC
by Philippe Cloutier
LastModif
Tuesday 19 February, 2019 18:43:17 UTC


Show PHP error messages