-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Make tooltips interactive themselves #7532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of #7531 (comment):
The events on the tooltip is not working because of:
Lines 71 to 76 in f018e2d
if (this.options.interactive) { | |
DomUtil.addClass(this._container, 'leaflet-clickable'); | |
if (this._source) { | |
this._source.addInteractiveTarget(this._container); | |
} | |
} |
it adds the interactiveTarget to the source
and not to the layer self. This is fixed with this PR additionally it adds the event parent source
which makes the changes not to a breaking change.
I came after my research to the exact same changes
And maybe |
ea58d73
to
8eafaff
Compare
8eafaff
to
bba7672
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Next step to mark PR "ready for review"
Please explain what you mean |
With |
No, it should fire on source layer - it is really intended so. |
Next step is decide how to be with closing on P.S. |
But why? A tooltip can also be a own layer on the map, so why not fireing events on it? And with the event parent it still fires on the source layer.
|
So it already has all related events ('remove', not 'tooltipclose') |
Ok yes sorry, you are right didn't thought about that one.
Ah sorry, didn't thought that you want to add this in this PR.
I know that I had some usecase where I wanted to add a click listener on the tooltip. But I don't know for what exactly anymore. |
It will be easy to add too, but with clear map
But you are right, it is not necessary in this PR.
Me too) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! How do we surface this in the docs?
May be this way: 9251b80 |
But then DivOverlay and Popup would be "marked" as interactive too, but the code is missing.
https://jsfiddle.net/falkedesign/xqc9mbzd/ But in my eyes it would make sense to add interactive to DivOverlay too. |
Perhaps not every descendant of @mourner @IvanSanchez |
if we add interactive to DivOverlay it would create new possibilities for plugins. Sure it can be added manually but why not make it easier for developers? What is the harm if we add it to DivOverlay? If a descendant should not support interactive it can be manually set to false in the |
9251b80
to
2fce66b
Compare
@Falke-Design |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Good to know: click
event will not fire on the Popup because of:
Line 184 in cc9f327
DomEvent.disableClickPropagation(container); |
5979213
to
04aa84d
Compare
Now it's possible to attach listeners to tooltip
7172b7c
to
df66fe1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mourner valid for me, the tests are covering all changes
mytooltip.on('click', ...
More ideas:
Close on
preclick
is not good..Perhaps better something like this: