Repository navigation
Blocks Hotspot
Version: 1.0.0 Category: DesignSetGo Keywords: image, tooltip, marker, hotspot
The Hotspot Block places interactive markers over an image. Each marker (a Hotspot Item) opens a tooltip describing that point on the image — a diagram callout, a "shop the look" tag, a floor-plan annotation, or a step in a visual process.
A Hotspot block only ever contains Hotspot Item children; you cannot insert a Hotspot Item anywhere else.
- Add the Block: Insert the Hotspot block. It comes with two starter markers already placed on the canvas.
- Choose an Image: In the Settings panel, click Select image.
-
Position Markers: Click a marker to select it, then drag it to the spot you want, or use the arrow keys (hold
Shiftfor larger 10% jumps). - Edit Tooltips: Click a marker to open its tooltip on the canvas, then type the description directly into it.
- Add More Markers: With the Hotspot block selected, use the Add hotspot button in the toolbar.
- Image — Select/replace the background image via the Media Library.
- Alternative text — Alt text for the image.
-
Trigger —
Click(default) orHover. Controls how every marker opens its tooltip unless a marker overrides it. -
Tooltip position —
Top(default),Right,Bottom,Left. Default side for tooltips relative to their marker. - Tooltip width — 120–600px (default 240px).
-
Marker animation —
Pulse(default),Scale,Fade, orNone. Applied to every marker unless a marker overrides it. -
Sequence duration — 0–3000ms (default 0). Staggers each marker's animation start by
sequenceOrder × sequenceDuration, so markers can pulse in a wave rather than in unison.
Under Colors in the block's Color panel:
- Marker color / Marker background — the marker circle's text/icon and fill colors.
- Tooltip background / Tooltip text color.
- Show only selected hotspot / Show all hotspots (eye icon) — editor-only view toggle that hides every marker except the selected one, useful when markers overlap. It never affects saved output.
- Add / Duplicate / Move / Remove hotspot — manages Hotspot Item children. Duplicating a marker gives the copy a fresh internal ID so its ARIA wiring doesn't collide with the original.
The image doubles as a coordinate canvas. With a marker selected:
- Drag it with the mouse/pointer.
-
Arrow keys nudge it 1% per press, or 10% with
Shiftheld.
Position updates are announced to screen readers (e.g. "Hotspot position: 42% horizontal, 60% vertical").
Each marker is a designsetgo/hotspot-item. It cannot be inserted on its own — only added inside a Hotspot block — and doesn't appear in the block inserter.
-
Label — Text shown on the marker (default
+). - Icon text — An optional symbol/emoji shown instead of the label.
-
Link — Optional URL. Only
https,http,mailto, andtellinks are used; anything else (e.g.javascript:) is silently ignored and the marker stays a plain button. -
Trigger override —
Inherit from Hotspot(default),Click, orHover. -
Tooltip position —
Inherit from Hotspot(default) or an explicit side. - Tooltip width — Inherits from the parent by default; can be set per marker (120–600px).
-
Marker animation —
Inherit from Hotspot(default),Pulse,Scale,Fade,None. - Sequence order — 0–20 (default 0). Multiplied by the parent's sequence duration to delay this marker's animation.
-
Horizontal origin / Vertical origin —
Left/Center/RightandTop/Center/Bottom(both defaultCenter). Controls which point of the marker sits on the x/y coordinate — useful for anchoring a marker flush against the edge of a small target area instead of centering it.
- If a marker has a Link, it always renders as an
<a>and keeps normal browser navigation — its tooltip opens on hover/focus only, and a click is never intercepted. - Without a link, a click-trigger marker toggles its tooltip open/closed via a
<button>witharia-expanded/aria-controls; a hover-trigger marker usesaria-describedbyand opens on pointer/focus. - If a marker has no meaningful visible text — an icon is set, or the label is empty or the default
+— it gets an accessiblearia-label="Hotspot"automatically.
Place markers on a lifestyle photo, each linking to a product page.
Annotate parts of a diagram or floor plan with short descriptions.
Use Sequence order + Sequence duration to have markers pulse in order, guiding the eye across the image.
Hover-triggered markers that reveal a short tip without requiring a click — good for onboarding screenshots.
DO:
- Keep tooltip text short — it's a callout, not a paragraph.
- Use Hover trigger for desktop-only tours; use Click (the default) when the page also needs to work on touch devices.
- Give linked markers a clear label or icon so the destination is predictable.
DON'T:
- Overlap markers so closely that dragging one is difficult — use Show only selected hotspot while positioning.
- Rely on marker color alone to convey meaning (also vary label/icon).
- Nest a Hotspot inside another Hotspot's tooltip.
-
Keyboard: Markers are focusable buttons/links.
Tabmoves between them;Enter/Space(or click) toggles a click-trigger tooltip.Escapecloses every open tooltip on the page and returns focus to the marker that opened it. -
ARIA: Click-trigger markers expose
aria-expanded/aria-controls; hover-trigger and linked markers exposearia-describedby. The tooltip itself carriesrole="tooltip". -
Screen readers: Icon-only or unlabeled markers get a fallback
aria-label="Hotspot". Dragging a marker in the editor announces its new position as a percentage. -
Reduced motion: Marker pulse/scale/fade animations and tooltip transitions are disabled under
prefers-reduced-motion: reduce.
Context: The parent block provides trigger, tooltipPosition, tooltipWidth, animation, and sequenceDuration via block context (designsetgo/hotspot/*). A Hotspot Item consumes these and falls back to them whenever its own attribute is 'inherit' (or, for tooltipWidth, unset).
DOM structure (frontend):
<div class="dsgo-hotspot" data-dsgo-hotspot="true" data-dsgo-hotspot-trigger="click">
<div class="dsgo-hotspot__image-wrap">
<img class="dsgo-hotspot__image" src="..." alt="..." />
<div class="dsgo-hotspot__items">
<div class="dsgo-hotspot-item" data-dsgo-hotspot-item="true">
<button class="dsgo-hotspot-item__marker" data-dsgo-hotspot-marker="true">+</button>
<div class="dsgo-hotspot-item__tooltip" data-dsgo-hotspot-tooltip="true" role="tooltip" hidden>…</div>
</div>
</div>
</div>
</div>Frontend interactivity (view.js) uses one set of delegated document listeners (click, pointerover, pointerout, focusin, focusout, keydown) shared by every Hotspot block on the page, rather than per-marker listeners:
- Opening a click-trigger item closes any other open item in the same parent Hotspot; separate Hotspot blocks stay independent.
- A linked marker (
<a href>) always behaves like a hover item for tooltip purposes, regardless of the resolved trigger, since its click must be left free to navigate. -
Escapecloses every open tooltip on the page and restores focus to the marker whose item had it.
Security: getSafeHotspotUrl() (src/blocks/hotspot-item/utils.js) allow-lists https:, http:, mailto:, tel: — anything else is dropped and the marker saves as a <button> instead of an <a>. getSafeHotspotColor() allow-lists WordPress preset var tokens, hex, and rgb()/hsl() functional colors before they're written into inline CSS custom properties.
Deprecation: hotspot-item/deprecated.js ships one entry (v1) that flags previously-saved markers which predate the current, broader accessible-label rule (any marker with an icon, an empty label, or the default + label now gets aria-label="Hotspot"). Its migrate() is an identity function — the entry exists only to route matching content back through the current save() so the label gets added.
Tests: src/blocks/hotspot/test/save.test.js, src/blocks/hotspot/test/view.test.js, src/blocks/hotspot-item/test/save.test.js.
Auto-generated from
docs/blocks/HOTSPOT.md. To update, edit the source file and changes will sync on next push to main.
- Accordion
- Advanced Heading
- Blobs
- Breadcrumbs
- Card
- Chart
- Comparison Table
- Countdown Timer
- Counter Group
- Divider
- Dynamic Image
- Fifty Fifty
- Flip Card
- Form Builder
- Grid
- Hotspot
- Icon
- Icon Button
- Icon List
- Image Accordion
- Map
- Modal
- Modal Api Reference
- Modal Auto Triggers
- Modal Fse Compatibility
- Modal Gallery Navigation
- Modal Trigger
- Pill
- Product Categories Grid
- Product Showcase Hero
- Progress Bar
- Query
- Query Filter
- Query Group Header
- Query No Results
- Query Pagination
- Query Results
- Row
- Scroll Accordion
- Scroll Marquee
- Scroll Slides
- Section
- Section Divider
- Slider
- Star Rating
- Sticky Sections
- Table Of Contents
- Tabs
- Text Path
- Timeline
- Background Video
- Block Animations
- Clickable Group
- Conditional Visibility
- Custom Css
- Draft Mode
- Dynamic Tags
- Expanding Background
- Grid Mobile Order
- Grid Span
- Hover Effects
- Max Width
- Responsive Visibility
- Reveal Control
- Scroll Parallax
- Sticky Header
- Style Binding
- Svg Patterns
- Text Alignment Inheritance
- Text Reveal
- Abilities Api
- Abilities Api Guide
- Block Bindings
- Draft Mode Api
- Form Webhooks
- Generation Contract
- Interactive Blocks
- Layout Flexibility
- Markdown Content Negotiation
- Rest Api Reference
- Wp Cli Reference
- Ai Assisted Development
- Best Practices Summary
- Block Controls Organization
- Block Development Best Practices Comprehensive
- Block Exclusion Guide
- Deploying To Wordpress Org
- Design System
- 2026 04 16 Blocks Editor Ux Design
- 2026 04 17 Theme 3 Inspector Ia
- 2026 04 21 Query Block Onboarding
- 2026 04 21 Query Capable Layout Blocks Design
- 2026 04 27 Block Roadmap Ideas
- 2026 07 01 Shape Divider Theme Inheritance
- 2026 07 02 Icon Block Dynamic Render Pilot
- 2026 07 06 Section Divider Block Design
- 2026 07 06 Section Style Variations Fse Design
- 2026 07 06 Section Styles Editor Preview
- 2026 07 07 Row Grid Overlay Hover Parity Design
- 2026 07 21 Conditional And Dup Label Sourcing
- 2026 07 23 Theme Block Type Animation Defaults
- 2026 08 16 Chart Block
- 2026 08 16 Greenshift Gap Roadmap
- 2026 08 17 Woocommerce Surface
- 2026 08 24 Loop Carousel
- 2026 08 24 Star Rating Block
- 2026 09 17 Abilities Drift Prevention
- 2026 09 17 Abilities Drift Prevention Implementation
- 2026 09 29 Existing User Regression Fixes
- 2026 09 29 Release Preflight Fixes
- Readme
- 2026 07 02 Block Authorability Audit
- 2026 09 29 Regression Fixes
- 2026 09 29 Release 2.9.0
- 2026 09 29 Release Fixes
- 2026 10 19 Bug Hunt
- 2026 10 20 Bug Hunt Round 2