- Issue created by @spelcheck
- πΊπΈUnited States spelcheck
Looks like patches are no longer recommended- will create a MR, but here's what I'm using now.
I just want to say kudos to the developers for designing this module to apply a 10px offset default when no modifiers are passed. popperjs default offset is 0, way too close! I expect most of time it's overridden, at least it is in examples.
I've been playing around with popperJS on its own and noticed the default popperjs offset is 0, far too close. Plenty of ways to adjust that, and did that in a sandbox just fine. After I installed this module, I noticed the offset was also set to 0. As recommended in the documentation, using modifiers for popperjs I bumped it to 10px.
{% set options = {"content": item.tooltip_content, "placement": "auto", "modifiers": [{"name": "offset", "options": {"offset": [0, 10]}}]} %}
I figure maybe I should just set that default in tooltip.js, so I don't need to maintain a bunch of nested objects, arrays in twig. When in tooltip.js, instanciateTooltip() is already built to set a default of 10. That's what I was going to set it to anyways, but then why wasn't it applying when I wasn't using a modifier?
Use the twig examples in the documentation, don't use 'modifiers' and the tooltip is right up against the triggering element. console.log() the incoming attr.modifiers, etc.
When we check whether an offset modifier is passed, use 'some' instead of 'filter' so it properly detects the fallback empty array when attr.modifiers is undefined so it can push the offset.
Active
1.1
Code
Looks like patches are no longer recommended- will create a MR, but here's what I'm using now.