Skip to content

Commit 161fdfe

Browse files
committed
fix: mobile nav drawer flash and topic link close behavior
1 parent 2c0d0e5 commit 161fdfe

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎index.html‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
</script>
4343
<style>
4444
[x-cloak] { display: none !important; }
45+
@media (min-width: 1024px) { aside[x-cloak] { display: block !important; } }
4546
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
4647
.prose h1, .prose h2, .prose h3, .prose h4 { scroll-margin-top: 5rem; }
4748
.code-block { counter-reset: line; }
@@ -86,7 +87,7 @@
8687
</header>
8788

8889
<div class="flex min-h-screen pt-16">
89-
<aside class="fixed top-16 bottom-0 left-0 z-40 w-72 transform border-r border-github-200 bg-github-50 transition-transform duration-200 ease-in-out lg:translate-x-0 overflow-y-auto custom-scroll dark:border-github-800 dark:bg-github-900"
90+
<aside x-cloak class="fixed top-16 bottom-0 left-0 z-40 w-72 transform border-r border-github-200 bg-github-50 transition-transform duration-200 ease-in-out lg:translate-x-0 overflow-y-auto custom-scroll dark:border-github-800 dark:bg-github-900"
9091
:class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'"
9192
@click.away="sidebarOpen = false">
9293
<nav class="px-4 py-6" aria-label="Guide navigation">
@@ -103,7 +104,7 @@ <h3 class="mb-2 px-2 text-xs font-semibold uppercase tracking-wider text-github-
103104
</button>
104105
<div x-show="isModuleOpen(module.id)" class="mt-1 space-y-0.5">
105106
<template x-for="topic in module.topics" :key="topic.id">
106-
<a :href="'#' + topic.id" @click.prevent="window.location.hash = topic.id"
107+
<a :href="'#' + topic.id" @click.prevent="window.location.hash = topic.id; if (window.innerWidth < 1024) sidebarOpen = false"
107108
class="block rounded-md px-3 py-1.5 text-sm transition-colors border-l-4"
108109
:class="activeTopic === topic.id ? 'bg-php-100 text-php-900 font-medium border-php-600 dark:bg-php-900/30 dark:text-php-300' : 'text-github-600 hover:bg-github-100 hover:text-github-900 border-transparent dark:text-github-400 dark:hover:bg-github-800 dark:hover:text-github-200'"
109110
:aria-current="activeTopic === topic.id ? 'page' : false"

0 commit comments

Comments
 (0)