From fae2fe7d423dc12dda3eec8c8638513b1fa5e8a2 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 22 Aug 2025 23:31:03 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20Add=20support=20for=20aria?= =?UTF-8?q?-current=20in=20menus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/class/link.class.php | 6 ++++-- bl-themes/defaultTheme/css/style.css | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bl-kernel/class/link.class.php b/bl-kernel/class/link.class.php index f2c6ba68..a4be04ee 100644 --- a/bl-kernel/class/link.class.php +++ b/bl-kernel/class/link.class.php @@ -20,7 +20,9 @@ class Link { function isActive() { - return false; + global $url; + global $site; + return str_ends_with($this->href, $url->uri()) || ($this->href == $site->url() && $url->uri() == "/"); } function haveClass() @@ -35,6 +37,6 @@ class Link { function toHTML() { - return "haveClass() ? "class='" . $this->getClasses() . "'" : "" ) . " >".$this->label.""; + return "haveClass() ? "class='" . $this->getClasses() . "'" : "" ) . ($this->isActive() ? "aria-current='page'" : "") . " >".$this->label.""; } } \ No newline at end of file diff --git a/bl-themes/defaultTheme/css/style.css b/bl-themes/defaultTheme/css/style.css index ec3dd69a..deafdfa7 100755 --- a/bl-themes/defaultTheme/css/style.css +++ b/bl-themes/defaultTheme/css/style.css @@ -51,7 +51,8 @@ header#main-header { border-radius: var(--border-radius); padding:8px; } - a:hover { + a:hover, + a.active { background-color: rgba(255,255,255,0.2); } } @@ -129,6 +130,10 @@ aside { .plugin { margin-bottom: 1rem; } + + a.active { + font-weight: bold; + } } nav ul {