Skip to content

feat(tour): render the tour panel in React, with a ReactNode body (1.4.0) - #31

Merged
galangel merged 42 commits into
mainfrom
feat/ORIONIQ-2232-react-tour-panel
Nov 26, 2026
Merged

galangel merged 42 commits into
mainfrom
feat/ORIONIQ-2232-react-tour-panel

Conversation

@galangel

Copy link
Copy Markdown
Owner

Description

1.4.0 renders the tour panel in React, so a step can carry React content: a new body: ReactNode. It also fixes four bugs in the panel.

Logz.io's Hermes shows an announcement as a one-step tour whose body is markdown rendered by a React component. 1.3.0 built the panel as an HTML string and injected it, so that wasn't possible. See logzio/Artemis#898 and ORIONIQ-2232.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change. For tour and tooltip users it isn't one: text and content steps render as before. The type of TooltipState.content and the TipMagicAction payloads widens from string to ReactNode, and both are visible through useTipMagicContext. Code that reads state.tooltip.content as a string would stop compiling. That's internal state, so this ships as a minor.
  • Documentation update

Changes Made

  • The panel is a React TourPanel (src/hooks/useTour/TourPanel.tsx), replacing the HTML string builder.
    • Every class name and data attribute is kept (data-tour-action, data-tip-magic-primary, tip-magic-tour-*), so the delegated clicks, autoFocus and the CSS are unchanged.
    • The panel is keyed by step, so each step mounts fresh. Without that, React reused Next as the next step's Finish and autoFocus: 'panel' broke.
  • Step content is exactly one of:
    • text (plain text);
    • body: ReactNode | (step) => ReactNode (new);
    • content (HTML, injected into the message element only, as before).
  • TooltipShowOptions.content accepts a ReactNode. html still applies to strings only.
  • A body renders inside TipMagicProvider's context, so any provider it needs (theme, router) must sit above the provider. This is documented in the README, Flows.mdx and CLAUDE.md.
  • Fixes, each with a regression test that fails on 1.3.0:
    • text escaped twice when the step had no panel features;
    • a step whose only feature is a title dropped its title;
    • nextLabel, backLabel and finishLabel were inserted as markup;
    • unmounting the component running a tour left the panel up with dead buttons. Now the panel, backdrop, highlight and flow come down without onEnd or onExit.
  • A tall body scrolls:
    • .tip-magic-tour-body has a max height of var(--tip-magic-tour-body-max-height, 60vh) and scrolls;
    • Floating UI's size() publishes --tip-magic-available-height, which only the tour panel reads, so plain tooltips are never clamped.
  • Docs: the README, Flows and Properties MDX, CLAUDE.md gotchas, and a long-body story.
  • Release: 1.4.0.

Testing

  • Unit tests pass: npm run validate with 390 tests; npm run build and npm run build:storybook pass.
  • Integration tests pass (useTour.integration.test.tsx, extended).
  • Manual testing in headless Chromium against the built Storybook:
    • a long body scrolls at 900px and 480px viewports, with the footer visible;
    • size() keeps the panel inside the viewport;
    • a React onClick in the body works, and Escape ends the tour;
    • the header-to-media gap is 12px, as before;
    • native video autoplays muted.
  • Not checked: Firefox and Safari, screen-reader output, and whether flip with size() stays stable while scrolling or resizing.

Additional Notes

  • Browsers without :has() show a 20px header-to-media gap instead of 12px.
  • Already true before this PR: tsconfig.build.json also emits declarations for *.test.tsx.

The tour panel was assembled as an HTML string and injected, so a step could
not carry React content. TourPanel now renders it as a React element that the
tour passes to the tooltip as its content, keeping every class name and data
attribute the delegated click handling, autoFocus and stylesheet rely on.

- TourStepContent gains `body: ReactNode | (step) => ReactNode`. `text` is
  rendered as text by React; `content` stays HTML, injected only into the
  message element.
- TooltipShowOptions.content accepts any React node; `html` applies to strings.
- Fixes `text` being escaped twice on a step with no panel features, and
  navigation labels being inserted as unescaped markup.
A title was not one of the features that switch a step from a plain tooltip
to the tour panel, so with `showClose: false` and no controls, media or
progress the title was silently dropped. A title now renders the panel.
…mounts

The unmount cleanup only destroyed the target watcher, backdrop and highlight,
so a tour whose component unmounted mid-tour left its panel on screen with
buttons nothing listened to any more. The cleanup now also hides the tooltip,
ends the helper flow and resets the tour's state, without calling onExit or
onEnd. A tour that is not running leaves the tooltip alone.
`.tip-magic-tour-body` now scrolls past `--tip-magic-tour-body-max-height`
(60vh by default). The tooltip runs Floating UI's size() middleware and
exposes the room beside the target as `--tip-magic-available-height`; the
tour panel, now a flex column, caps itself to it so only the body shrinks.
Plain tooltips read neither and are not clamped.
…body

README and the published Flows/Properties pages describe the three step body
forms, that only `content` is still injected as HTML, where a `body` gets its
context from, the body's scroll limit, and that unmounting mid-tour ends the
tour silently. A new "The Tourtip/React body" story shows a long, stateful
React body.
A `body` step with no other panel features was shown as a plain tooltip, which
ignores the pointer and has no scrolling body, so its React handlers never
fired and a long body could not scroll. A `body` now always renders the panel.
A `content` step with no panel features was handed to the tooltip without
`html`, so unless the consumer set `tooltipOptions.html` its markup showed as
literal text - contradicting the documented contract that `content` is HTML.
useTour now forces `html: true` for `content`, as it forces `false` for `text`.
The panel element was built once per step, so a `body` was a snapshot: a
consumer that re-rendered with new `steps` while the tour ran (markdown that
arrived after a fetch) kept showing the old content. The tooltip now holds a
LiveTourPanel that reads its props from a TourPanelStore, and useTour pushes
the current step's props into it whenever its steps or options change. Focus,
scroll and the step callbacks are untouched, and the panel's DOM is kept.
…mount

The unmount cleanup tore the tour down synchronously, so under StrictMode the
simulated unmount closed a tour started from a guarded mount effect, and the
remount never reopened it. The teardown - including destroying the backdrop,
highlight and target watcher - now runs a microtask later and is skipped when
the hook has mounted again. A real unmount still ends the tour.
React sets `muted` only as a property, while 1.3.0's HTML had the attribute,
which iOS Safari's autoplay policy reads. A muted video now also gets the
`muted` attribute and `defaultMuted` through a ref callback.
`body: ReactNode` accepted null and undefined, so a step could satisfy the
"exactly one of text, body or content" union with no body at all. It is now
`NonNullable<ReactNode> | ((step) => ReactNode)`.

A body is present when it is not undefined, everywhere: an `undefined` body
spread onto a `content` step - legal for the `body?: never` variant - no
longer forces the panel the way `'body' in step` did.
The body now scrolls, which stops margins collapsing through it, so a body of
paragraphs (rendered markdown) showed its first and last margins as extra
space inside the panel.
README gains "Upgrading to 1.4": `tooltip.content` is null while a tour panel
shows, a custom `progress.render` sits in a `display: contents` wrapper, and
the other observable behavior changes. CLAUDE.md now says a `content` step
without panel features is forced to `html: true` and a `body` step always
renders the panel.
@galangel

Copy link
Copy Markdown
Owner Author

AI review (Claude /code-review) of 5ec108f..ccb6b6d: findings and resolution. Each bug fix has a regression test that fails before the fix.

# Finding Resolution
1 (important) A body step with no panel features rendered as a plain tooltip you can't click or scroll. Fixed in 61d7c48. A body step always renders the panel.
2 (important) A body was a snapshot: new steps while a tour runs didn't reach the panel. Fixed in 84f2262. The panel reads its contents from a TourPanelStore that useTour updates when the steps change. The DOM, focus and scroll are kept, and onStepChange/onEnter don't fire again. Routing it through tooltip.show would loop when steps are passed inline. A plain-tooltip text/content step picks up changes on the next navigation, as documented.
3 (important) StrictMode's simulated unmount tore down a tour started from a guarded mount effect. Fixed in ae8df60. Teardown (panel, flow, backdrop, highlight, watcher) runs one microtask later and is skipped if the hook mounted again. A real unmount still tears down.
4 (important) React sets muted only as a property, which iOS Safari's autoplay policy may reject. Fixed in dc67857. A ref callback writes the muted attribute and defaultMuted; playsInline was already set.
5 body accepted null/undefined. Fixed in 0784f72. It's NonNullable<ReactNode> | fn. A body counts as present when it isn't undefined, rather than by 'body' in step, so a content step spread with body: undefined still works.
6 A markdown <p> body got larger gaps once margins stopped collapsing. Fixed in cd8d0f3. The message's first and last children get no outer margins.
7 A custom progress.render sits inside an extra display: contents wrapper. Kept and documented in 4425bcf. React can't render an HTML string without an element, short of inserting DOM by hand against React's own children. Layout is unchanged; only a .tip-magic-tour-footer > .x child selector is affected, as the upgrade notes say.
8 useTipMagic().tooltip.content is null while a panel shows. Documented in 4425bcf ("Upgrading to 1.4" in the README).
9 (pre-existing) A content step with no panel showed literal markup unless html was set. Fixed in 3af0832. html: true is forced for content, as false already was for text.

Gate: npm run validate (402 tests), npm run build, npm run build:storybook. Headless Chromium against Storybook: the muted attribute is present, the long body scrolls, the footer stays visible, the body's click handler works, Escape ends the tour, and the 12px gap holds.

All steps shared one TourPanelStore. Setting it re-renders the subscribed
panel synchronously, while the dispatch that swaps in the next step's keyed
panel can land in a later render - a navigation inside startTransition, for
one - so the outgoing panel briefly rendered the next step's body, remounting
or re-rendering a component in the wrong panel. Every shown step now gets a
fresh store, passed only to its own LiveTourPanel.
The in-place update matched the shown step by index, so when `steps` shifted -
a condition filtering out an earlier step - the panel showed another step's
content at the old target, and steps shrinking below the shown index left a
stuck panel. A running tour now follows the shown step by its target:

- still there, at the same or a new index: updated in place, the index moved
  without firing callbacks;
- gone, with a step at its place: moved on as a navigation (onExit, onEnter,
  onStepChange);
- gone, past the end: the tour ends with onEnd(false).

An in-place update also re-shows the tooltip when a panel-derived option
changed - a title appearing now sets aria-labelledby - and onExit is called
on the step actually on screen rather than whatever `steps` holds at its index.
Each presented panel gets a unique key, so a moved index cannot reuse a panel.
…ount

The deferred unmount teardown hid the tooltip and ended the helper flow
unconditionally. When a route change swapped one touring component for another
whose mount effect starts a tour, the first one's teardown ran after the second
had started, and took the second tour's panel and flow down.

HIDE_TOOLTIP and END_FLOW take an optional ownership check (`onlyIfContent`,
`onlyIfSteps`), and the unmount teardown passes the content it showed and the
flow steps it started. The tour's own backdrop, highlight and watcher are still
cleaned up.
…nent

With the unmount teardown deferred, a target rendered inside the unmounting
component detached first: the target watcher's MutationObserver reported it,
and handleTargetLost ended the tour with onTargetMissing (or a console
warning), onExit and onEnd(false). The unmount cleanup is now a layout effect
that clears a mounted flag during the unmount commit, before the observer's
callback, and handleTargetLost ignores a lost target once it is clear.
StrictMode's simulated unmount sets it again on remount, so the watcher keeps
working there.
`body` accepted booleans and '', and a function body could return null or
undefined - all render nothing, yet the step still got the panel: an empty
dialog that took focus. `body` no longer accepts a boolean, and at runtime a
body that resolves to null, undefined, a boolean or '' is treated as no body,
so the step follows the same path as one with no text or content. The panel
decision now looks at the resolved body.
…a panel

Forcing `html: true` for a `content` step with no panel features overrode an
explicit `tooltipOptions.html: false` at the tour or step level, which a 1.3
consumer may rely on to show an untrusted string as text - injecting it. HTML
is now the default for `content` there, and an explicit `false` wins.
The ref that wrote the `muted` attribute only ever added it, so a video whose
`muted` went from true to false on the same src kept the attribute. The ref now
sets `defaultMuted` either way; it reflects the `muted` attribute (checked in
jsdom and Chromium), which also makes the separate setAttribute redundant.
@galangel

Copy link
Copy Markdown
Owner Author

AI review (Claude /code-review) of only the fix commits ccb6b6d..4425bcf: findings and resolution. Each fix has a regression test that fails before it.

# Finding Resolution
1 (important) The deferred unmount teardown could hide the next tour's panel and end its flow. Fixed in ac885c6. HIDE_TOOLTIP and END_FLOW take an ownership check (onlyIfContent, onlyIfSteps), so the cleanup releases only what this tour still owns. Tested: A unmounts while B mounts and starts in the same commit, and B survives.
2 (important) A target unmounting with the touring component fired onTargetMissing, onExit and onEnd(false). Fixed in f453a0f. A layout-effect cleanup clears a mounted flag before the observer reports, and a lost target is ignored once it's clear. StrictMode's remount sets it again. Tested with the target inside the component.
3 (important) The in-place update matched the shown step by index. Fixed in 136d2a4. The step on screen is followed by its target: updated in place where it now is, or navigated forward (with callbacks) if removed. onExit is called on the step actually shown.
4 (important) A shared panel store let the old panel render the next step's props. Fixed in a815221. Each shown step gets its own store. Reproduced with navigation inside startTransition; the test fails if step 1's body instance ever renders step 2.
5 An in-place update didn't recompute ariaLabelledBy / autoFocus. Fixed in 136d2a4. The tooltip is shown again when they change, and only then, so it can't loop.
6 body: notes && <X/> with empty notes opened an empty dialog. Fixed in 719816c. body is Exclude<NonNullable<ReactNode>, boolean> | fn. At runtime, a body that resolves to nothing (null, a boolean, '') counts as no body. '' can't be excluded in the type.
7 Forcing html: true overrode an explicit html: false (a 1.3 consumer could rely on it for untrusted strings). Fixed in 34bd177. An explicit false wins at step or tour level; the upgrade notes say so.
8 The muted attribute was never removed. Fixed in 6ee3c75. defaultMuted follows the prop both ways, and the redundant setAttribute is gone.
9 (pre-existing) Steps shrinking below the shown one left a stuck panel. Fixed in 136d2a4. The tour ends with onEnd(false).

That ends the review loop for this PR (review, fix, review the fixes, fix). Gate: npm run validate (415 tests), npm run build, and npm run build:storybook; headless Chromium re-checked the scrolling body, the footer, click handlers, Escape and the muted attribute.

…red targets

A running step was followed by `target` alone. With two steps on the same
element, inserting a step ahead of them left the same target at the shown
index, so the panel silently showed the other step - no onExit, no
onStepChange - and findIndex picked the earlier one when the target did move.

TourStep gains an optional `id`. When the order of the visible steps changed,
the step on screen is found again by its `id`, else by its `target` only when
no other step shares it. A step that cannot be told apart is treated like a
removed one: the step now at its place is shown as a navigation, with its
callbacks. An unchanged order keeps the in-place update, so inline `steps`
re-created on every render cannot loop.
The unmount teardown released the tooltip only if it still held the content
this tour showed. A plain-text step's content is a string, so two tours
showing the same text compared equal: when a route swap mounted a tour that
starts in a layout effect - before the outgoing tour's deferred teardown - the
outgoing tour hid it.

`tooltip.show` takes an optional `owner` object, kept on the tooltip state
until it is next shown or hidden, and HIDE_TOOLTIP's `onlyIfContent` becomes
`onlyIfOwner`. useTour mints a fresh owner per show. The new test fails with
the ownership check removed, as does the existing route-swap test.
…close button

A `body` step always renders the panel, a role="dialog" that takes focus; with
no title nothing named it. The panel is now labelled by its title or, without
one, by its message element, which gets a generated id.

The embed iframe had no title: it takes `video.title`, defaulting to "Tour
video". The close button's fixed "Close" label is now `navigation.closeLabel`,
defaulting to "Close", alongside the configurable Next/Back/Finish labels.
…r flow in step

An in-place update re-showed the tooltip only when aria-labelledby or
autoFocus changed, so a new `placement`, `maxWidth`, `showArrow` or other
tooltip option on the step on screen was ignored. All shown options are now
compared by value (`haveSameTooltipOptions`, ignoring content and owner) and
the tooltip is shown again when any changed - still loop-safe, since equal
values do not show. A plain-tooltip step's text is now updated in place too.

The helper flow kept the `start()` snapshot of the steps, so after
[A, B, C] -> [B, C] `helper.currentStep` was A while the tour showed B. The
flow is rebuilt from the visible steps when they differ by value, and moved
to the followed index.
A first step whose body renders nothing and that has no other panel feature
was handed to the tooltip as '', which tooltip.show ignores - after start()
had already set isActive and called onStart. start() now returns false, with
no state change and no onStart, when the first renderable step has nothing to
show.

What counts as nothing is now what React renders no nodes for: null,
undefined, a boolean, '', and fragments or arrays of only those, recursively.
`body: <></>` and `body: []` no longer open an empty dialog.
The upgrade notes now say that TooltipState.content and the SHOW/MOVE payloads
widened from string to ReactNode (exported context types), that
UPDATE_TOOLTIP_CONTENT / tooltip.updateContent stay string and replace a
running tour's panel, that CurrentTourStep.content is '' for a `body` step,
that an untitled panel is labelled by its message, that start() returns false
for a first step with nothing to show, and that the new owner/ownership
payloads are additive.
@galangel

Copy link
Copy Markdown
Owner Author

External review (Cursor, Grok 4.7 High; focus on KISS, open-source practice and common sense): findings and resolution.

Verdict: "ship after fixes". The reviewer judged the panel store, the per-step store, the deferred teardown, the mounted flag and the click delegation justified, and they stay. Each finding was reproduced at 0a3ebef by a test that failed before the fix.

# Finding Resolution
1 Following the shown step by target breaks when two steps share a target. Fixed in 6248963. An optional TourStep.id. A step is re-identified only when the visible order changes: by id, else by a target that no other step shares. When that's ambiguous or the step is gone, the step now at its place is shown as a navigation. Documented in Flows.mdx and the README.
2 onlyIfContent compared content by value, so two plain-text steps with equal text could let one tour hide the other. Fixed in 45b0c48. tooltip.show takes an owner token minted per show, and HIDE_TOOLTIP checks onlyIfOwner. The new test starts B in useLayoutEffect with the same text and fails with the check removed. Not reproduced: the claim that the existing route-swap test never reaches the race; with the check removed, that test fails too.
3 A body step with no title was an unnamed dialog that takes focus. Fixed in 193f7b8. An untitled panel is labelled by its message. The embed iframe takes video.title (default "Tour video"), and the close button navigation.closeLabel (default "Close").
4 In-place updates ignored a changed placement, maxWidth and the like, and the helper flow kept the start() snapshot. Fixed in 76236a1. Every shown option is compared by value and re-shown on a change (equal values never re-show, so no loop). The flow is rebuilt from the visible steps and moved to the followed step. A plain-tooltip step's text now also updates in place.
5 The upgrade notes missed the TooltipState.content / action payload widening. Fixed in a0ec35b. The notes also cover updateContent still taking a string, CurrentTourStep.content being '' for body, untitled panels, start() returning false, and the additive owner / ownership checks.
6 A body that renders nothing left the tour active with no UI, and <></> or [] weren't treated as empty. Fixed in fa025c9. rendersNothing looks through fragments and arrays, and start() returns false (no onStart) when the first step has no panel and nothing to show.

Gate: npm run validate (443 tests), npm run build, npm run build:storybook, and CI green.

Known gap, pre-existing and out of scope: an empty step reached later by next() (or text: '') still leaves the previous tooltip on screen.

…& Tours

The two stories were their own 'The Tourtip/...' entries, which turned The
Tourtip into a sidebar group, and were built with ad-hoc markup and styles.
They are now the Auto Focus and React Body stories of Tooltip/Flow & Tours,
built like the rest of that group: the MockDashboard, the tour-demo classes,
in-demo buttons instead of controls, and a description in the group's style.
Their stylesheet blocks are gone. Flows.mdx links to both, and Welcome.mdx's
link to the tour playground points at its real story id.
An announcement is not about any element, so `TourStep.target` is now
optional. A step without one opens centered in the viewport - fixed, so it
stays centered as the page scrolls or resizes - with no arrow and the focus
backdrop on by default, with nothing cut out of it. A tour- or step-level
`focus` still turns the backdrop off or makes it dismissible. Everything else
is the same panel: title, media, body, navigation, progress, autoFocus,
Escape and the accessible name.

With no target there is nothing to highlight, scroll to or watch, so
onTargetMissing never fires for it; following a changed `steps` finds such a
step by its `id`, or by position. Centered and anchored steps mix in one tour.

Underneath, `TooltipShowOptions` gains `centered`: Tooltip then positions with
a `centerInViewport` middleware and the `fixed` strategy, drops the arrow, and
never animates a move between centered and anchored. `CurrentTourStep.target`
becomes optional with it.
…wording

The step now shows the image the Tour With Images story opens with, above its
body, and its button reads "Show announcement" / "Showing announcement…"
rather than the multi-step tours' "Tour in Progress...", since it is an
announcement, not a tour.
A one-step tour with no target: it opens centered over a dimmed page, with a
title, an image, a long React body that scrolls, and a "Got it" button,
started from the demo's button. Built like the other Flow & Tours stories.
…the viewport

A centered step (no target) with an image or a native video now takes its
width from the media: its natural width, capped at
--tip-magic-tour-centered-max-width (70vw) and an explicit maxWidth, with the
title, body and footer wrapping inside it. The media keeps its aspect ratio and
is never cropped: when it would leave too little height for the text
(--tip-magic-tour-media-reserved-height) it is scaled down uniformly. The
panel is never narrower than --tip-magic-tour-min-width (280px), and a
smaller image is centered at its natural size. The panel stays hidden until
the media's size is known (or it fails to load), so it does not open narrow
and widen.

Every centered panel is at most --tip-magic-tour-centered-max-height (80vh,
80dvh where supported) tall; its body scrolls past that.

Done in CSS - fit-content width, `contain: inline-size` on everything but the
media, and viewport-unit max sizes on the media - with `maxWidth: 'none'` on
the tooltip for such a step: TooltipShowOptions.maxWidth and
ParsedTooltipData.maxWidth now accept 'none'. Embeds, steps without media and
anchored steps are unchanged.
The story gains buttons to show its announcement with the 400x200 image, a
wide 1200x600 one, a portrait 400x700 one and a tiny 160x90 one, and
describes the sizing rule.
A centered announcement can be just a video, with no title or text. The step
content union gains a media-only variant: no `text`, `body` or `content`, but
an `image` or a `video` (whose type is now exported as `TourVideo`). A step with
nothing to show still does not compile.

Such a step renders the panel like any other, and with no title and no text
its dialog is labelled by the video, which carries `aria-label` from
`video.title` (default "Tour video", for native videos as well as embeds). A
panel that is nothing but its media (no title, text or footer) reserves only
--tip-magic-tour-media-only-reserved-height below it, so the media may use
nearly all of the 80% height. Without buttons it can be closed by Escape, or by
a backdrop click with `focus: { dismissOnClick: true }`; a click on the media
itself does not close it.
…n Announcement

Video Announcement is a centered step that is only a wide native video (Big
Buck Bunny, 1920x1080) with no title, text or buttons: a click outside it or
Escape closes it. The Announcement story now passes autoFocus: 'primary', as
Hermes will, so Enter dismisses it.
…side

A media-only panel showed 10px beside its video but 18px above and below it:
the media's own 12px margins stacked on the panel padding, and an empty body
followed it. The body is no longer rendered when there is no message, the
panel's first and last parts drop their outer margin (as the message's
children do), and media that is the panel's only part gets the difference
between the horizontal and vertical padding above and below it - 10px on all
four sides with the default theme.
With size() capping the panel at the room beside its target, an anchored
panel near a viewport edge was clamped to a height smaller than its title,
media and footer, which then overflowed the panel's box; because the panel
fit, flip() never moved it. The panel content now has `min-height:
min-content`: only the body gives way, and below that the panel overflows its
side, so flip() places it where it fits (the Tour With Images story's first
step moves beside the sidebar). Layout only, so verified in Chromium rather
than jsdom.
…r flipping

581c287's `min-height: min-content` kept a squeezed panel's media inside it,
but it also counted the body's whole text, so a long body stopped shrinking
to the room beside the target and the panel ran off the viewport. Instead the
panel's height cap never drops below --tip-magic-tour-min-height (240px): the
body still gives way down to that, and with less room than that the panel
overflows its side, which is what makes flip() move it. Checked in Chromium:
the Tour With Images first step still flips beside the sidebar, and a long
React body at 600x800 fits the viewport again.
`mediaPlacement: 'top' | 'left' | 'right'` (TourOptions, overridable per step;
type TourMediaPlacement) defaults to 'top', the existing layout. Beside the
text, the panel is a two-column grid: the media in one column, and in the
other the title, the body - which takes the height left and scrolls - and the
footer at the bottom. The close button sits at the panel's top-right corner,
with a backdrop of its own when it is over the media.

The text column takes up to half of the panel, between
--tip-magic-tour-min-width (280px) and --tip-magic-tour-side-text-max-width
(400px), with the panel padding as the gap; the media gets the rest at its
aspect ratio and is never taller than the panel may be. A centered panel stays
within --tip-magic-tour-centered-max-width and -max-height, an anchored one
within the viewport and the room beside its target, and both within an
explicit maxWidth; the tooltip's default 300px cap is lifted otherwise. Below a
640px viewport the media goes back on top (a media query), and a step with no
media, or nothing but media, ignores the option.
@galangel
galangel merged commit e974197 into main Nov 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant