Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Makes targetable Tooltips interactive#3520

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
AnnMarieW wants to merge6 commits intoplotly:dev
base:dev
Choose a base branch
Loading
fromAnnMarieW:make-targetable-tooltip-interactive

Conversation

@AnnMarieW
Copy link
Collaborator

@AnnMarieWAnnMarieW commentedNov 18, 2025
edited
Loading

closes#2759

This PR fixes the issue where it was not possible to interact with Tooltip content (like clicking on a button) without setting thepointer-events styling.

It setspointer-events toauto on the tooltip content whentargetable=True

TO DO:

Here is an app similar to the one @celia-lm used in the issue. It would make a good example for the docs too!

Decided to go with a different example for the docs:https://github.com/plotly/ddk-dash-docs/pull/3607

fromdashimportDash,dcc,html,Input,Output,no_update,callback,ctximportplotly.expressaspxfig=px.scatter(x=[1,2,3],y=[1,2,1],text=["A","B","C"])fig.update_traces(hoverinfo="none",hovertemplate=None,marker=dict(size=40))fig.update_traces(textfont_color="white")app=Dash(__name__)app.layout=html.Div(    [html.H3("Tooltip button callback output"),html.Div("No tooltip button clicked yet",id="out"),dcc.Graph(id="graph",figure=fig,clear_on_unhover=True),dcc.Tooltip(id="tooltip",targetable=True,children=html.Button(id="hover-click",children="Click me!"),        ),    ],style={"margin":"20px"},)# adapted from https://dash.plotly.com/dash-core-components/tooltip#styling-tooltip-with-background-and-border-color@callback(Output("tooltip","show"),Output("tooltip","bbox"),Input("graph","hoverData"),Input("hover-click","n_clicks"),)defupdate_tooltip_content(hoverData,clicks):# close the tooltip when the button is clickedifctx.triggered_id=="hover-click":returnFalse,no_update# keep the tooltip open if we move away from the point, until we hover over another pointifhoverDataisNone:returnno_update,no_updatept=hoverData["points"][0]bbox=pt["bbox"]returnTrue,bbox@callback(Output("out","children"),Input("hover-click","n_clicks"),prevent_initial_call=True,)defsave_changes(clicks):returnf"Button has been clicked{clicks} times!"if__name__=="__main__":app.run(debug=True)

tootip-pr

Copy link
Contributor

@T4rk1nT4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

💃

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@T4rk1nT4rk1nT4rk1n approved these changes

@ndreznndreznAwaiting requested review from ndreznndrezn is a code owner

@emilyklemilyklAwaiting requested review from emilyklemilykl is a code owner

Assignees

@T4rk1nT4rk1n

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

dcc.Tooltip children isn't clickable even with targetable=True

2 participants

@AnnMarieW@T4rk1n

[8]ページ先頭

©2009-2025 Movatter.jp