terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
17.5k stars 430 forks source link

Tooltips are not working #2091

Closed BaronBonet closed 2 months ago

BaronBonet commented 2 months ago

First off thanks to everyone who is working on this project. D2 is awesome!

I think tooltips are broken.

In the below example that can be found here on play.d2lang.

y: {tooltip: test}
x -> y

I do not see the tooltip when I hover over y.

The tooltip section of the docs is also not showing the tooltop

alixander commented 2 months ago

@BaronBonet Thank you!

If you hover over the shapes here (leave your mouse for a few seconds), does a tooltip show up? https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title

If not, you likely have some nonstandard accessibility settings in your browser/OS.

BaronBonet commented 2 months ago

@alixander I'm just crazy impatient sorry about this! The tooltip does show up after I wait with my mouse still for about 2 seconds.

I'm surprised how long it takes. I was expecting the implementation to act more like the tooltips I'm familiar with e.g. this example on W3Schools which shows the tooltip instantly.

I assume there is a good reason they are not implemented this way?

BaronBonet commented 2 months ago

Ah, I see this is how tooltips are implemented with SVG elements. My apologies for wasting your time @alixander !

alixander commented 2 months ago

Yeah it's not ideal but it's the most universal way with the least amount of intrusion from the standpoint of an external library adding extra DOM nodes.