From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 3 Aug 2018 21:58:20 +0000 (+0200)
Subject: Fix wrong hint label position on xkcd.com.
X-Git-Url: https://git.owens.tech/wrapped.html/wrapped.html/git?a=commitdiff_plain;h=c5bf3b7ea15aa0d856c7732fa38cdcdda5e21c56;p=vimb.git

Fix wrong hint label position on xkcd.com.

On some pages which set the body to fixed position the hint labels where
placed far away from the hinted element. This patch fixes this issue by
setting the position of the label to fixed instead of absolute.
This fixes #506.
---

diff --git a/src/scripts/hints.css b/src/scripts/hints.css
index 847d11b..34e5bda 100644
--- a/src/scripts/hints.css
+++ b/src/scripts/hints.css
@@ -10,7 +10,7 @@ span[vimbhint^='label']{
     margin:0;
     opacity:0.7;
     padding:0px 1px;
-    position:absolute;
+    position:fixed !important;
     z-index:225000
 }
 *[vimbhint^='hint']{
diff --git a/tests/.gitignore b/tests/.gitignore
index f83e6dd..c802245 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,3 +1 @@
-*
-!*.c
-!Makefile
+/test-*
diff --git a/tests/manual/hints-absolute-positioned-body.html b/tests/manual/hints-absolute-positioned-body.html
new file mode 100644
index 0000000..2aa370a
--- /dev/null
+++ b/tests/manual/hints-absolute-positioned-body.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style type="text/css">
+    body {
+        position: absolute;
+        left: 50%;
+        width: 500px;
+        margin-left: -250px;
+    }
+    </style>
+    <title>Hint Label on pages with absolute positioned body</title>
+</head>
+<body>
+    <p>
+        When using hints (f) on this page, the hint should be placed on
+        the upper left corner of the links.
+        <a href="#one">one</a><br/>
+        <a href="#two">two</a>
+    </p>
+</body>
+</html>