League-of-Foundry-Developers / fvtt-module-popout

FVTT Module PopOut!
Other
29 stars 24 forks source link

When using PopOut the Foundry provided `data-tooltip` CSS attribute does not work #97

Closed ryanwalder closed 1 year ago

ryanwalder commented 1 year ago

Hi I'm a developer on the Cyberpunk RED Core system and we make heavy use of the data-tooltip CSS attribute for tooltips to provide information to the player for sheet functionality. Unfortunately when using PopOut this does not work.

Example, Character Sheet not Popped Out (but module active):

Peek 2023-02-23 18-52

Example, Character Sheet Popped Out:

Peek 2023-02-23 18-49

Is this a PopOut bug or is there potentially anything we could do to support PopOut better?

Posnet commented 1 year ago

PopOut should preserve all css imports in popouts. Could you please provide the OS, Browser, foundry version and module/system versions for me to reproduce the issue. Ideally if you can provide a zip file of a test world, that would be appreciated.

ryanwalder commented 1 year ago

Versions:

FVTT: v10.291 (NodeJS v19.7.0)
CPRC: v0.86.1
PopOut: v2.10
OS: Arch Linux (up to date)
Browser: Firefox v110.0

Also to note: This bug was raised to me from a Windows 10 user, not 100% sure which browser they were using.

This happens on all worlds using Cyberpunk RED but here is a test setup world: popout-example.zip

Here are some gifs showing the issue in the current version (the ones above were taking in my dev branch where I'm rewriting the sheet and remembered about this bug):

PopOut Module loaded, sheet not popped out:

popout-in

PopOut Module loaded, sheet popped out:

popout-out

Some example code using the data-tooltip attribute from the system:

<a class="calculate-hp" data-tooltip="{{localize "CPR.characterSheet.leftPane.calculateMaxHp"}}">
  <i class="fas fa-calculator"></i>
</a>

Some example code from the foundry UI using the same data-tooltip attribute (the left hand side Tokens/Select Tokens UI):

<li class="control-tool active" data-tool="select" data-tooltip="CONTROLS.BasicSelect" aria-describedby="tooltip">
  <i class="fas fa-expand"></i>
</li>

Some (very) quick testing by popping out the combat tracker shows that the tooltips do not work for Foundry UI items either:

Not popped out:

ct-not

Popped:

ct-popped

Posnet commented 1 year ago

Thank you for the additional information that is very helpful. I have identified the cause as being Tooltip manager of global document access. This will require a complex set of global monkey patches similar to ba31dc2 to fix. And you are correct this is broken for all tooltips as of v10.

Posnet commented 1 year ago

@ryanwalder I have pushed a partial fix with the latest release 2.13, it ended up being more complex to try and fix than I expected, and it will only fix the basic data-tooltip use case. Direct tooltip.activate calls in a system are still broken, and are un-fixable. If you are still seeing issues with basic tooltips, please re-open/comment on the issue.