fix(popover): render dynamic outputs in title-less popover/tooltip#1327
Open
gadenbuie wants to merge 4 commits into
Open
fix(popover): render dynamic outputs in title-less popover/tooltip#1327gadenbuie wants to merge 4 commits into
gadenbuie wants to merge 4 commits into
Conversation
A dynamically-rendered shiny output (e.g. uiOutput()) inside a popover() or tooltip() with no title failed to render because shiny's IntersectionObserver lands on bslib's boxless display:contents wrapper. Add a temporary min-width:1px rule on shiny outputs inside popovers/tooltips so the output's ResizeObserver fires. Remove once shiny handles display:contents wrappers upstream. Refs #1326
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #1326
Dynamically-rendered outputs (e.g.
uiOutput()) inside apopover()ortooltip()with no title failed to render — the output stayed stuck "recalculating" and never appeared. (With a title, the same output renders fine.)Cause
This is an upstream Shiny regression introduced in shiny 1.14.0 (rstudio/shiny#4388). Shiny's
IntersectionObserver-based visibility detection ends up targeting bslib's boxlessdisplay:contentspopover/tooltip wrapper, so it never fires when the popover opens. The output'sResizeObserveris then the only trigger left, and it only fires if the output's box size changes — which, in a title-less popover, it doesn't (the empty output measures 0×0 both before and after opening).Full root-cause analysis and the proposed Shiny-side fix are tracked in rstudio/shiny#4406.
Fix (temporary workaround)
Add a tiny CSS rule giving shiny outputs inside popovers/tooltips a
min-width: 1px, which guarantees a non-zero box so theResizeObserverfires when the popover opens. Once the output has content it becomesdisplay:contents, so the rule is a no-op — no visual impact.inst/components/scss/tooltip-popover.scssinst/components/dist/components.cssviatools/compile_component_sass.RThis is a workaround pending the upstream Shiny fix (rstudio/shiny#4406); once that ships, this rule can be removed.