squidfunk / mkdocs-material

Documentation that simply works

Home Page:https://squidfunk.github.io/mkdocs-material/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tooltip doesn't appear on links with ellipsis when inside collapsed nav sections

wilhelmer opened this issue · comments

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Bildschirmaufnahme.2022-06-15.um.10.49.12.mov

Expected behaviour

When enabling content.tooltips, tooltips should appear on all links that are shortened with ellipsis.

Actual behaviour

Navigation items that are shortened with ellipsis inside collapsed sections don't have tooltips.

After reloading the page with the section expanded, the tooltip appears. See video.

Steps to reproduce

See video.

Package versions

  • Python: 3.9.13
  • MkDocs: 1.3.0
  • Material: 8.3.4+insiders.4.18.0

Configuration

site_name: Test Project
theme:
    name: material
    features:
        - content.tooltips
use_directory_urls: false
plugins:
  - offline
nav:
  - Welcome: index.md
  - Section:
      - Subsection:
        - VeryVeryVeryVeryVeryVeryLongTopicTile: second.md

System information

  • Operating system: macOS Monterey
  • Browser: Firefox

Fixed in 57ea24b. The reason for this behavior was that all elements with the md-ellipsis class were only filtered once the document was loaded (and on every instant loading event), and then filtered for whether they show an ellipsis or not, i.e. overflow. Initially invisible elements were always filtered, which means that tooltips were never mounted, even though they became visible later. Now, every element is watched for visibility, and once it becomes visible, the tooltip is mounted. If it becomes invisible again, the tooltip is retained. I first checked if we could just add and remove tooltips when elements change visibility, but that led to an increase in pressure on the rendering engine, especially when you scroll fast.

For this reason, keeping elements once they become visible once is the best compromise. With navigation tabs and sections enabled, there may be many elements that will never become visible on larger screens, i.e. for the inactive tabs, which need to be included for mobile navigation.

Released as part of 8.3.6+insiders-4.18.2.

Confirming that this is fixed in 4.18.2. Thanks so much!