Files
landing_page/qdrant-landing/themes/qdrant-2024/layouts/partials/documentation/sidebar-menu.html
T
Abdon PijpelinkandClaude Sonnet 4.6 1321a7fcce fix(docs): prevent iOS Safari from navigating on sidebar section tap (#2646)
* fix(docs): prevent iOS Safari from navigating on sidebar section tap

On iOS/iPadOS, tapping a collapsed section in the documentation sidebar
followed the <a> href inside the <summary> instead of toggling the
<details> element. This navigated away from the page and closed the
hamburger menu.

Added a click handler in documentation.js that intercepts the link tap
when the parent <details> is closed, preventing navigation and manually
expanding the section instead. Tapping an already-open section still
navigates to the section root page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix issue where all clicks on a collapsed section header were intercepted, preventing navigation even when tapping the link text. Now only taps in the chevron zone (right-padding area of the link) trigger the toggle.

Wraps the title text in a <span> to mark the text boundary, then uses getBoundingClientRect() to compare the tap's X position against the span's right edge. This is more reliable than checking e.target, which iOS Safari inconsistently reports as the parent <a> for non-interactive child elements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-21 14:01:43 +02:00

198 lines
8.0 KiB
HTML

{{ $partition := .partition }}
{{ $currentNode := .context }}
<div class="docs-menu">
<div id="sidebar" class="docs-menu__content">
{{ if eq $currentNode.Section "articles" }}
<h3 class="docs-menu__links-title">Articles</h3>
<nav>
<div class="docs-menu__links-group">
{{ $subject := site.GetPage "articles" }}
{{ range $subject.Pages }}
{{ if .Params.isCategoryPage }}
<div
class="docs-menu__articles-link docs-menu__links-group-heading
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}active{{ end }}"
>
<a href="{{ .Params.url }}">{{ .Params.title }}</a>
</div>
{{ end }}
{{ end }}
</div>
</nav>
{{ else }}
{{ $pathSegments := split (trim $currentNode.RelPermalink "/") "/" }}
{{ $numLevels := len $pathSegments }}
{{ $subject := $currentNode }}
{{ if eq $numLevels 1 }}
{{ $subject = $currentNode }}
<!-- top-level, `/documentation` -->
{{ else if eq $numLevels 2 }}
{{ $subject = $currentNode.Parent }}
<!-- not top-level, `/documentation/essentials` -->
{{ else if eq $numLevels 3 }}
{{ $subject = $currentNode.Parent.Parent }}
<!-- not top-level, `/documentation/essentials/day-0` -->
{{ else if eq $numLevels 4 }}
{{ $subject = $currentNode.Parent.Parent.Parent }}
<!-- not top-level, `/documentation/essentials/day-0/introduction` -->
{{ else }}
{{ $subject = $currentNode.Parent.Parent.Parent }}
<!-- not top-level, `/documentation/essentials/day-0/introduction/overview` -->
{{ end }}
<nav class="docs-menu__links">
{{ range $subject.Pages }}
{{ if and (eq .Params.partition $partition) (not .Params.hideInSidebar) }}
{{ if (eq .Params.type "delimiter") }}
<h3 class="docs-menu__links-title">{{ .Title }}</h3>
{{ else if eq .Params.type "reference" }}
{{ $page := site.GetPage .Params.reference }}
<div
class="docs-menu__links-group {{ if eq $page.File.UniqueID $currentNode.File.UniqueID }}active{{ end }}
{{- if (eq $page.Params.type "external-link") }}external-link{{ end -}} "
>
<div class="docs-menu__links-group-heading">
<a
href="{{ if (eq $page.Params.type "external-link") }}
{{ $page.Params.external_url }}
{{ else }}
{{ $page.Permalink }}
{{ end }}"
{{ if (eq $page.Params.type "external-link") }}target="_blank"{{ end }}
>
{{ $page.Title }}
</a>
</div>
</div>
{{ else }}
{{ if and (.IsPage) (not .Params.hideInSidebar) }}
<div
class="docs-menu__links-group {{ if eq .File.UniqueID $currentNode.File.UniqueID }}active{{ end }}
{{- if (eq .Params.type "external-link") }}external-link{{ end -}} "
>
<div class="docs-menu__links-group-heading">
<a
href="{{ if (eq .Params.type "external-link") }}
{{ .Params.external_url }}
{{ else }}
{{ .Permalink }}
{{ end }}"
{{ if (eq .Params.type "external-link") }}target="_blank"{{ end }}
>
{{ .Title }}
</a>
</div>
</div>
{{ end }}
{{ if and (.IsSection) (not .Params.hideInSidebar) }}
<!-- current page is active or any sub-page is active -->
{{ $isActive := false }}
{{ range .RegularPages }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $isActive = true }}
{{ end }}
{{ end }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $isActive = true }}
{{ end }}
{{ range .Sections }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $isActive = true }}
{{ end }}
{{ range .RegularPages }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $isActive = true }}
{{ end }}
{{ end }}
{{ end }}
{{ $sectionLink := .Permalink }}
{{ if .Params.is_empty }}
{{ $sectionLink = (index (.RegularPages) 0).Permalink }}
{{ end }}
<details
class="docs-menu__links-group link-group {{ if $isActive }}active{{ end }}"
{{ if $isActive }}open{{ end }}
>
<summary class="docs-menu__links-group-heading">
<a href="{{ $sectionLink }}">
<span>{{ .Title }}</span>
</a>
</summary>
<nav>
<ul class="docs-menu__links-submenu">
{{ range .RegularPages }}
{{ if (eq .Params.type "external-link") }}
<li class="docs-menu__links-submenu-item">
<a href="{{ .Params.external_url }}" target="_blank">
{{ .Title }}
{{ partial "svg" "external-link.svg" }}
</a>
</li>
{{ else if not .Params.hideInSidebar }}
<li
class="docs-menu__links-submenu-item{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
active
{{ end }}"
>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
{{ range .Sections }}
{{ if not .Params.hideInSidebar }}
{{ $subIsActive := false }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $subIsActive = true }}
{{ end }}
{{ range .RegularPages }}
{{ if eq .File.UniqueID $currentNode.File.UniqueID }}
{{ $subIsActive = true }}
{{ end }}
{{ end }}
<li class="docs-menu__links-submenu-item docs-menu__links-submenu-item--section">
<details {{ if $subIsActive }}open{{ end }}>
<summary{{ if eq .File.UniqueID $currentNode.File.UniqueID }} class="active"{{ end }}><a href="{{ .Permalink }}"><span>{{ .Title }}</span></a></summary>
<ul class="docs-menu__links-sub-submenu">
{{ range .RegularPages }}
{{ if not .Params.hideInSidebar }}
<li class="docs-menu__links-sub-submenu-item{{ if eq .File.UniqueID $currentNode.File.UniqueID }} active{{ end }}">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</details>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
</details>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</nav>
{{ end }}
</div>
</div>