Skip to content

Commit a309968

Browse files
authored
Should hide the tooltip on page resize as well (#52)
- unset focus on cached page back and force navigation - some type fix Signed-off-by: Hofi <[email protected]>
2 parents e29e7c4 + 4c6d83c commit a309968

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

_js/custom/navigation.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ $(function () {
148148
// Try to scroll to a giben anchor, if any
149149
if (anchorId)
150150
scrollToAnchor(anchorId);
151+
// Clear any focus (e.g back navigation keeps the previously clicked link focused)
152+
window.trigger('blur');
151153
}
152154

153155
function updateContentFromUrl(url) {
@@ -709,6 +711,11 @@ $(function () {
709711
elementUnderCursor = event.target;
710712
});
711713

714+
window.addEventListener('resize', function () {
715+
if (tooltipTarget)
716+
hideTooltip(true);
717+
});
718+
712719
window.addEventListener('blur', function () {
713720
if (tooltipTarget)
714721
hideTooltip(true);

_js/main.min.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8539,6 +8539,7 @@ $(function() {
85398539
if (ClipboardJS.isSupported()) addCodeBlocksTitle();
85408540
addContentTooltips();
85418541
if (anchorId) scrollToAnchor(anchorId);
8542+
window.trigger("blur");
85428543
}
85438544
function updateContentFromUrl(url) {
85448545
var currContent = document.querySelector(contentID);
@@ -8876,6 +8877,9 @@ $(function() {
88768877
document.addEventListener("mouseover", function(event) {
88778878
elementUnderCursor = event.target;
88788879
});
8880+
window.addEventListener("resize", function() {
8881+
if (tooltipTarget) hideTooltip(true);
8882+
});
88798883
window.addEventListener("blur", function() {
88808884
if (tooltipTarget) hideTooltip(true);
88818885
});

_plugins/generate_tooltips.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def make_tooltip(page, page_links, id, url, match)
5858
link_data = page_links[id]
5959
if link_data != nil
6060
url = link_data["url"]
61-
url = prefixed_url(url, page.site.config["baseurl"])
61+
url = prefixed_url(url, page.site.config["baseurl"])
6262
else
6363
puts "Error: Unknown ID in matching part: #{match_parts}"
6464
return match
@@ -309,7 +309,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
309309

310310
page_link_data = page_links_dictionary[alias_id]
311311
if page_link_data == nil
312-
puts "Error: Unknow ID (#{alias_id}) in alias definition"
312+
puts "Error: Unknown ID (#{alias_id}) in alias definition"
313313
exit 4
314314
end
315315
page_link_data["title"].concat(alias_data["aliases"])

0 commit comments

Comments
 (0)