plotly / plotly/dash

[BUG] Data table tooltips position is wrong when combined with sorting

Open
#3,404 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

dash                 3.2.0
plotly                6.3.0

When using a data table with tooltips assigned, tooltips display at the correct position when native sorting is ascending, but when sorting is set to descending, the tooltips pop up in their old position usually off screen while the data is reversed.

import dash
from dash.dependencies import Input, Output, State
from dash import dcc, html
from dash import dash_table as dt

app = dash.Dash(__name__,
                suppress_callback_exceptions=True)

tooltips = [
    {'a': {
        'type': 'markdown',
        'value': '| x | y |\n| :--- | :--- |\n' + '\n'.join([f'| {n} | {n} |' for i in range(10)]) + '\n|   |   |\n',
    }} for n in range(100)
]
app.layout = html.Div([
    html.Div(dt.DataTable(
        id='datatable',
        columns=[
            {'name': 'a', 'id': 'a'},
            {'name': 'b', 'id': 'b'},
        ],
        data=[{'id': i, 'a': i, 'b': i*2}
              for i in range(100)],
        tooltip_data=tooltips,
        sort_action='native',
    ), id='datatable-div'),
])

    
if __name__ == '__main__':
    app.run(debug=True)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Python Dash app with dash 3.2.0 and plotly 6.3.0, then inspect the DataTable tooltip and native sorting behavior. Done means tooltips remain aligned with their rows after descending sorting instead of using their pre-sort positions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.