squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.09k stars 3.47k forks source link

[Bug] After the table is sorted, the tooltip is misplaced #7453

Closed Xiaokang2022 closed 2 weeks ago

Xiaokang2022 commented 3 weeks ago

Context

Bug description

The way I added sorting to the table is what the documentation mentioned: https://squidfunk.github.io/mkdocs-material/reference/data-tables/#sortable-tables

When I use the following code to create a table, a bug occurs:

| Id  | Value           |
| --- | --------------- |
| 1   | A { title="A" } |
| 2   | B               |
| 3   | C               |
| 4   | D               |
| 5   | E               |

Before sorting, the position of this tooltip ("A") is correct:

image

But after sorting, this tooltip is misplaced:

image

It was only when I re-scrolled the page that it came back to the correct place.

Related links

Reproduction

9.5.31-bug.zip

Steps to reproduce

  1. Create a table with a tooltip
  2. Introduce JS for table sorting
  3. Sort the column that contains the tooltip
  4. Check whether the tooltip is misplaced

Browser

Edge

Before submitting

squidfunk commented 3 weeks ago

Thanks for reporting. We'll look into it.

squidfunk commented 3 weeks ago

Fixed in e5c9575dd. Here's what happened and how it's fixed:

https://github.com/squidfunk/mkdocs-material/blob/e5c9575dda8b4e8b689efffda2690f5925ae7919/src/templates/assets/javascripts/components/tooltip2/index.ts#L138-L148

squidfunk commented 3 weeks ago

We'll leave it open until released.

squidfunk commented 2 weeks ago

Released as part of 9.5.33.