theme: fix overflowing issue tooltips #364

in rtl, the scrollbars were still in ltr mode which was now changed to avoid overflow of tooltips when attached to the "ending" corner of the box
This commit is contained in:
Sören Weber 2022-11-07 20:57:17 +01:00
parent e24c33c7aa
commit 54878e0407
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
11 changed files with 22 additions and 18 deletions

View file

@ -1,6 +1,6 @@
{{- partial "page-meta.hugo" . }}
<!DOCTYPE html>
<html lang="{{ .Page.Language | default "en" }}" dir="ltr">
<html lang="{{ .Page.Language | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
<head>
{{- partial "meta.html" . }}
{{- .Scratch.Add "title" "" }}
@ -28,7 +28,7 @@
<div id="sidebar-overlay"></div>
<main id="body-inner" class="chapter" tabindex="-1">
<div class="flex-block-wrapper">
<article class="default" dir="{{ T "Reading-direction" | default "ltr" }}">>
<article class="default">>
<h1>{{ T "title-404" }}</h1>
<p></p>
<p>{{ T "message-404" }}</p>

View file

@ -1,6 +1,6 @@
{{- partial "page-meta.hugo" . }}
{{- partial "header.html" . }}
<article dir="{{ T "Reading-direction" | default "ltr" }}">
<article>
<h1>{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}</h1>
<ul>

View file

@ -1,7 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
<article class="chapter" dir="{{ T "Reading-direction" | default "ltr" }}">
<article class="chapter">
{{ partial "heading-pre.html" . }}<div class="article-subheading">{{ T "Chapter" .Params.Weight }}</div>
<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}

View file

@ -1,7 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
<article class="default" dir="{{ T "Reading-direction" | default "ltr" }}">
<article class="default">
{{ partial "heading-pre.html" . }}<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}
{{ $content | safeHTML }}

View file

@ -1,7 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
<article class="chapter deprecated" dir="{{ T "Reading-direction" | default "ltr" }}">
<article class="chapter deprecated">
{{ $content | safeHTML }}
<footer class="footline">

View file

@ -1,7 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
<article class="home deprecated" dir="{{ T "Reading-direction" | default "ltr" }}">
<article class="home deprecated">
{{ $content | safeHTML }}
<footer class="footline">

View file

@ -1,7 +1,7 @@
{{- $page := .page }}
{{- $content := .content }}
{{- with $page }}
<article class="home" dir="{{ T "Reading-direction" | default "ltr" }}">
<article class="home">
{{ partial "heading-pre.html" . }}<h1>{{ .Title }}</h1>{{ partial "heading-post.html" . }}
{{ $content | safeHTML }}

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ .Page.Language | default "en" }}" dir="ltr">
<html lang="{{ .Page.Language | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
<head>
{{- partial "meta.html" . }}
{{- $page := . }}
@ -37,7 +37,7 @@
<div id="body" class="default-animation">
<div id="sidebar-overlay"></div>
<div id="toc-overlay"></div>
<nav id="topbar" class="highlightable">
<nav id="topbar" class="highlightable" dir="ltr">
<div>
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if $showPrevNext }}

View file

@ -1,6 +1,6 @@
{{- $showvisitedlinks := .Site.Params.showVisitedLinks }}
<aside id="sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}">
<aside id="sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}" dir="ltr">
{{- $currentNode := . }}
<div id="header-wrapper" class="default-animation">
<div id="header" class="default-animation">

View file

@ -1,7 +1,7 @@
{{- $page := . }}
{{- if .Params.tags }}
<div class="tags" dir="{{ T "Reading-direction" | default "ltr" }}">
<div class="tags">
{{- range sort .Params.tags }}
{{- $tag := . }}
{{- with $page.Site.GetPage (printf "%s%s" ("/tags/" | relURL ) ( $tag | urlize ) ) }}

View file

@ -250,13 +250,14 @@ function initAnchorClipboard(){
});
$(".anchor").on('mouseleave', function(e) {
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-se tooltipped-sw');
});
var clip = new ClipboardJS('.anchor');
clip.on('success', function(e) {
e.clearSelection();
$(e.trigger).attr('aria-label', window.T_Link_copied_to_clipboard).addClass('tooltipped tooltipped-s');
var rtl = $(e.trigger).closest('*[dir]').attr('dir') == 'rtl';
$(e.trigger).attr('aria-label', window.T_Link_copied_to_clipboard).addClass('tooltipped tooltipped-s'+(rtl?'e':'w') );
});
}
@ -300,14 +301,16 @@ function initCodeClipboard(){
clip.on('success', function(e) {
e.clearSelection();
var inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
var rtl = $(e.trigger).closest('*[dir]').attr('dir') == 'rtl';
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'+(rtl?'e':'w')));
});
clip.on('error', function(e) {
var inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
$(e.trigger).attr('aria-label', fallbackMessage(e.action)).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
var rtl = $(this).closest('*[dir]').attr('dir') == 'rtl';
$(e.trigger).attr('aria-label', fallbackMessage(e.action)).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'+(rtl?'e':'w')));
$(document).one('copy', function(){
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'+(rtl?'e':'w')));
});
});
@ -321,7 +324,8 @@ function initCodeClipboard(){
}
code.after( $('<span>').addClass("copy-to-clipboard-button").attr("title", window.T_Copy_to_clipboard).append("<i class='fas fa-copy'></i>") );
code.next('.copy-to-clipboard-button').on('mouseleave', function() {
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
var rtl = $(this).closest('*[dir]').attr('dir') == 'rtl';
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-w tooltipped-se tooltipped-sw');
});
}
});