Fix wrong hint label position on xkcd.com.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 3 Aug 2018 21:58:20 +0000 (23:58 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 3 Aug 2018 22:03:16 +0000 (00:03 +0200)
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.

src/scripts/hints.css
tests/.gitignore
tests/manual/hints-absolute-positioned-body.html [new file with mode: 0644]

index 847d11b..34e5bda 100644 (file)
@@ -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']{
index f83e6dd..c802245 100644 (file)
@@ -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 (file)
index 0000000..2aa370a
--- /dev/null
@@ -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>