Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
Xiaokang2022 opened this issue Aug 19, 2024 · 4 comments
Closed
4 tasks done

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

Xiaokang2022 opened this issue Aug 19, 2024 · 4 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@Xiaokang2022
Copy link

Context

  • OS: Windows 11 23H2
  • Browser: Edge 127.0.2651.74
  • mkdocs: 1.6.0
  • material: 9.5.31
  • Python: 3.12.0
  • tablesort: 5.3.0

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
Copy link
Owner

Thanks for reporting. We'll look into it.

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Aug 19, 2024
@squidfunk
Copy link
Owner

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

const offset$ =
defer(() => getElementContainers(el)).pipe(
mergeMap(watchElementContentOffset),
throttleTime(1),
// Note that we need to poll the value again if the active state changes,
// as otherwise the tooltip might be misplaced. This particularly happens
// when using third-party integrations like tablesort that change the
// position of elements – see https://t.ly/Y-V7X
combineLatestWith(active$),
map(() => getElementOffsetAbsolute(el)),
)

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels Aug 19, 2024
@squidfunk
Copy link
Owner

We'll leave it open until released.

@squidfunk squidfunk reopened this Aug 19, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants