From 1bcea71b27d73b97ac0827c4d650269f6946a2ea Mon Sep 17 00:00:00 2001 From: Abdallah Maouche Date: Sat, 2 Dec 2023 22:11:18 +0100 Subject: [PATCH 1/2] mode/hint: Group hints together outside of document's body --- source/mode/hint.lisp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/mode/hint.lisp b/source/mode/hint.lisp index 3603ffdd370..c511aa85c78 100644 --- a/source/mode/hint.lisp +++ b/source/mode/hint.lisp @@ -134,7 +134,7 @@ A positive value shifts to the bottom.") (ps:@ element text-content) hint) element)) - (let ((fragment (ps:chain document (create-document-fragment))) + (let ((hints-parent (ps:chain document (create-element "div"))) (hints (ps:lisp (list 'quote hints))) (nyxt-identifiers (ps:lisp (list 'quote nyxt-identifiers)))) (dotimes (i (length hints)) @@ -142,10 +142,12 @@ A positive value shifts to the bottom.") (nyxt-identifier (aref nyxt-identifiers i)) (element (nyxt/ps:rqs-nyxt-id document nyxt-identifier))) (ps:chain element (set-attribute "nyxt-hint" hint)) - (ps:chain fragment (append-child (create-hint-overlay element hint))) + (ps:chain hints-parent (append-child (create-hint-overlay element hint))) (when (ps:lisp (show-hint-scope-p (find-submode 'hint-mode))) (ps:chain element class-list (add "nyxt-element-hint"))))) - (ps:chain document body (append-child fragment)) + (setf (ps:@ hints-parent id) "nyxt-hints" + (ps:@ hints-parent style) "all: unset !important;") + (ps:chain document body parent-node (insert-before hints-parent (ps:@ document body next-sibling))) ;; Returning fragment makes WebKit choke. nil)) @@ -203,8 +205,9 @@ A positive value shifts to the bottom.") hintable-elements))))) (define-parenscript-async remove-hint-elements () - (ps:dolist (element (nyxt/ps:rqsa document ":not(.nyxt-search-node) > .nyxt-hint")) - (ps:chain element (remove))) + (ps:let ((hints-parent (nyxt/ps:qs-id document "nyxt-hints"))) + (ps:when hints-parent + (ps:chain hints-parent (remove)))) (when (ps:lisp (show-hint-scope-p (find-submode 'hint-mode))) (ps:dolist (element (nyxt/ps:rqsa document ".nyxt-element-hint")) (ps:chain element class-list (remove "nyxt-element-hint"))))) From b3ecc209ac1f6b4e5711207659d5c6c171f08851 Mon Sep 17 00:00:00 2001 From: Abdallah Maouche Date: Fri, 8 Dec 2023 18:52:50 +0100 Subject: [PATCH 2/2] changelog: Mention bug fix --- source/changelog.lisp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/changelog.lisp b/source/changelog.lisp index 055d852bc5b..95c79a4d416 100644 --- a/source/changelog.lisp +++ b/source/changelog.lisp @@ -948,4 +948,6 @@ enabling its customization.") (:li "The height of the " (:nxref :class-name 'message-buffer) " and " (:nxref :class-name 'status-buffer) " can be dynamically set and its UI elements are scaled accordingly.") - (:li "Remove experimental support for WebExtensions via " (:code "libnyxt") "."))) + (:li "Remove experimental support for WebExtensions via " (:code "libnyxt") ".") + (:li "Fix bug where the CSS of a webpage sets " (:code "display") " to " (:code "none") + " for elements matching hints.")))