From 93ef5771b6e2443dd787002d600a1ba715d901e7 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 12:28:02 +0000 Subject: cgit-about-filter: unhighlight on clicks outside links While a heading is the #fragment, a click anywhere but on a link removes the fragment, like a click on the heading itself. Other links work as before, and a click that ends a text selection keeps the highlight. --- .../simple/cgit-about-filter/cgit-about-filter.lua | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua index 7b36226..453c067 100644 --- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua +++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua @@ -228,24 +228,30 @@ local function slug(content) end -- Headings link to themselves, underlined on hover by cgit.css. Clicking --- the heading that is the #fragment removes the fragment again. Setting --- location.hash is what makes :target forget the heading; --- history.replaceState alone doesn't. +-- the heading that is the #fragment, or anywhere but on a link, removes the +-- fragment again, and with it the highlight. Setting location.hash is what +-- makes :target forget the heading; history.replaceState alone doesn't. local heading_links = [[ ]] -- cgit v1.3.1