1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +01:00

Fixed invalid tooltip position in tables when using table sort

This commit is contained in:
squidfunk 2024-08-19 18:40:43 +02:00
parent 7a770dc7be
commit e5c9575dda
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 14 additions and 8 deletions

View File

@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.471ce7a9.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.af256bd8.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -27,6 +27,7 @@ import {
Subject,
animationFrameScheduler,
combineLatest,
combineLatestWith,
debounce,
defer,
distinctUntilChanged,
@ -138,7 +139,12 @@ export function watchTooltip2(
defer(() => getElementContainers(el)).pipe(
mergeMap(watchElementContentOffset),
throttleTime(1),
map(() => getElementOffsetAbsolute(el))
// 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)),
)
// Only track parent elements and compute offset of the tooltip host if the