Fossil SCM

Fix the accordion section header on the /rchvdwnld web UI page, and have the accordion click-handler ignore clicks to hyperlinks inside section headers (so that the accordion section does not expand or contract immediately before navigating to the linked page).

florian 2025-11-04 16:07 trunk
Commit 6b31bcfc1b4f55450c5611a9ccdda8f0d286c7c75ff169aebfcc9f51b007feb4
2 files changed +4 -1 +1
--- src/accordion.js
+++ src/accordion.js
@@ -41,11 +41,14 @@
4141
a[i].insertBefore(img,a[i].firstChild);
4242
img = document.createElement("img");
4343
img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1];
4444
img.className = "accordion_btn accordion_btn_minus";
4545
a[i].insertBefore(img,a[i].firstChild);
46
- a[i].addEventListener("click",function(){
46
+ a[i].addEventListener("click",function(evt){
47
+ /* Ignore clicks to hyperlinks and form controls inside ".accordion" buttons
48
+ ** (for which Fossil uses <DIV> elements that represent section headers). */
49
+ if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } ) return;
4750
var x = this.nextElementSibling;
4851
if( this.classList.contains("accordion_closed") ){
4952
x.style.maxHeight = x.scrollHeight + "px";
5053
setTimeout(function(){
5154
x.style.maxHeight = "";
5255
--- src/accordion.js
+++ src/accordion.js
@@ -41,11 +41,14 @@
41 a[i].insertBefore(img,a[i].firstChild);
42 img = document.createElement("img");
43 img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1];
44 img.className = "accordion_btn accordion_btn_minus";
45 a[i].insertBefore(img,a[i].firstChild);
46 a[i].addEventListener("click",function(){
 
 
 
47 var x = this.nextElementSibling;
48 if( this.classList.contains("accordion_closed") ){
49 x.style.maxHeight = x.scrollHeight + "px";
50 setTimeout(function(){
51 x.style.maxHeight = "";
52
--- src/accordion.js
+++ src/accordion.js
@@ -41,11 +41,14 @@
41 a[i].insertBefore(img,a[i].firstChild);
42 img = document.createElement("img");
43 img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1];
44 img.className = "accordion_btn accordion_btn_minus";
45 a[i].insertBefore(img,a[i].firstChild);
46 a[i].addEventListener("click",function(evt){
47 /* Ignore clicks to hyperlinks and form controls inside ".accordion" buttons
48 ** (for which Fossil uses <DIV> elements that represent section headers). */
49 if( evt.target.tagName in { 'INPUT':1, 'SELECT':1, 'A':1 } ) return;
50 var x = this.nextElementSibling;
51 if( this.classList.contains("accordion_closed") ){
52 x.style.maxHeight = x.scrollHeight + "px";
53 setTimeout(function(){
54 x.style.maxHeight = "";
55
+1
--- src/tar.c
+++ src/tar.c
@@ -1356,7 +1356,8 @@
13561356
@ </table></div>
13571357
fossil_free(zBase);
13581358
@ <div class="section accordion">Context</div><div class="accordion_panel">
13591359
render_checkin_context(rid, 0, 0, 0);
13601360
@ </div>
1361
+ builtin_request_js("accordion.js");
13611362
style_finish_page();
13621363
}
13631364
--- src/tar.c
+++ src/tar.c
@@ -1356,7 +1356,8 @@
1356 @ </table></div>
1357 fossil_free(zBase);
1358 @ <div class="section accordion">Context</div><div class="accordion_panel">
1359 render_checkin_context(rid, 0, 0, 0);
1360 @ </div>
 
1361 style_finish_page();
1362 }
1363
--- src/tar.c
+++ src/tar.c
@@ -1356,7 +1356,8 @@
1356 @ </table></div>
1357 fossil_free(zBase);
1358 @ <div class="section accordion">Context</div><div class="accordion_panel">
1359 render_checkin_context(rid, 0, 0, 0);
1360 @ </div>
1361 builtin_request_js("accordion.js");
1362 style_finish_page();
1363 }
1364

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button