From c6010933dc481e95e3ab1768613f767eda3ba1e3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 23 May 2026 11:02:41 -0300 Subject: css, client: adapt to support hoverable/tooltip This is the first commit where we're using :has() and nested rules. Both of those are considered baseline December 2023, and we figure that will be at least *about* three years ago once this update is released. --- src/static/css/miscellany.css | 22 +++++--------- src/static/js/client/index.js | 2 -- src/static/js/client/summary-nested-link.js | 46 ----------------------------- 3 files changed, 7 insertions(+), 63 deletions(-) delete mode 100644 src/static/js/client/summary-nested-link.js (limited to 'src/static') diff --git a/src/static/css/miscellany.css b/src/static/css/miscellany.css index 37fefb40..0f4cf1a9 100644 --- a/src/static/css/miscellany.css +++ b/src/static/css/miscellany.css @@ -487,26 +487,18 @@ } @layer interaction { - summary > span:hover { + summary > span:hover:not(:has(.has-visible-tooltip, .hoverable:hover)) { cursor: pointer; text-decoration: underline; text-decoration-color: var(--primary-color); - } - - summary > span:hover a { - text-decoration: none !important; - } - summary > span:hover:has(a:hover), - summary > span:hover:has(a.nested-hover), - summary.has-nested-hover > span { - text-decoration: none !important; - } + a:not(:hover) { + text-decoration: none !important; + } - summary > span:hover:has(a:hover) a:hover, - summary > span:hover:has(a.nested-hover) a:hover, - summary.has-nested-hover > span a:hover { - text-decoration: underline !important; + &:has(a:hover) { + text-decoration: none !important; + } } summary.underline-white > span:hover { diff --git a/src/static/js/client/index.js b/src/static/js/client/index.js index 9296dff1..6862b4ad 100644 --- a/src/static/js/client/index.js +++ b/src/static/js/client/index.js @@ -22,7 +22,6 @@ import * as revealAllGridControlModule from './reveal-all-grid-control.js'; import * as scriptedLinkModule from './scripted-link.js'; import * as sidebarSearchModule from './sidebar-search.js'; import * as stickyHeadingModule from './sticky-heading.js'; -import * as summaryNestedLinkModule from './summary-nested-link.js'; import * as textWithTooltipModule from './text-with-tooltip.js'; import * as wikiSearchModule from './wiki-search.js'; @@ -49,7 +48,6 @@ export const modules = [ scriptedLinkModule, sidebarSearchModule, stickyHeadingModule, - summaryNestedLinkModule, textWithTooltipModule, wikiSearchModule, ]; diff --git a/src/static/js/client/summary-nested-link.js b/src/static/js/client/summary-nested-link.js deleted file mode 100644 index 1c4e7e4b..00000000 --- a/src/static/js/client/summary-nested-link.js +++ /dev/null @@ -1,46 +0,0 @@ -import { - empty, - filterMultipleArrays, - stitchArrays, -} from '../../shared-util/sugar.js'; - -export const info = { - id: 'summaryNestedLinkInfo', - - summaries: null, - links: null, -}; - -export function getPageReferences() { - info.summaries = - Array.from(document.getElementsByTagName('summary')); - - info.links = - info.summaries - .map(summary => - Array.from(summary.getElementsByTagName('a'))); - - filterMultipleArrays( - info.summaries, - info.links, - (_summary, links) => !empty(links)); -} - -export function addPageListeners() { - for (const {summary, links} of stitchArrays({ - summary: info.summaries, - links: info.links, - })) { - for (const link of links) { - link.addEventListener('mouseover', () => { - link.classList.add('nested-hover'); - summary.classList.add('has-nested-hover'); - }); - - link.addEventListener('mouseout', () => { - link.classList.remove('nested-hover'); - summary.classList.remove('has-nested-hover'); - }); - } - } -} -- cgit 1.3.0-6-gf8a5