Docs: rendering framework components as step content, and why DOM injection belongs in when.show
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- documentation, frontend
Direzione di ricerca
Inizia da docs-src/src/content/docs/recipes/cookbook.md e dalla ricetta when.show esistente per progress-indicator. Leggi il ciclo di vita di Step e il comportamento del componente del framework citati in shepherd-text.ts, quindi documenta il contenuto live di HTMLElement, il chrome opzionale della finestra di dialogo, la tempistica degli hook, il this basato su funzione, la sostituzione di when per ogni step e le query getElement con ambito limitato. Il lavoro è completato quando il cookbook spiega entrambi i pattern e la loro motivazione con esempi utilizzabili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Split out of #2533 and #3216. Both reporters hit the same documentation gap from different directions, and both waited a long time for an answer that should have been a docs link.
What's missing
1. Rendering a framework component as step content.
StepText accepts an HTMLElement, and shepherd-text.ts appends it directly rather than serialising it — so you can mount a live Vue/React/Svelte component to a detached node and hand that node to text, keeping reactivity and event handlers intact. Nothing in the docs says this. #2533 asked for it in Dec 2023, was told "pass HTML", asked for a demo, and never got one.
Worth documenting alongside it: the dialog chrome is Shepherd's own DOM, but everything inside is opt-out — no title/cancelIcon means no header, an empty buttons array means no footer, and arrow: false drops the arrow. With those off a component owns the entire body, which is what people asking this question actually want.
2. Why custom footer/DOM injection has to happen in when.show.
The step element is torn down and rebuilt on every show (_teardownElements() / _setupElements()), and createShepherdFooter builds a fresh <footer> each time. So a one-time DOM injection cannot survive a step change. #3216 spent a retry loop and a setTimeout ladder working around this without ever being told the element is simply recreated.
Two sharp edges belong in the same section:
- Inside
when.show,thisis the Step — an arrow function silently breaksthis.getElement(). - A per-step
whenreplacesdefaultStepOptions.whenwholesale (shallowObject.assignin_setOptions). - Scope queries with
this.getElement()rather thandocument.querySelector, which returns the first match in document order and will find a previous step's node, since hidden steps stay attached.
Suggested home
docs-src/src/content/docs/recipes/cookbook.md already demonstrates the when.show pattern for progress indicators without explaining why it must be that hook — extending that recipe and adding a "custom content / framework components" entry would cover both.
- Lingua principale
- JavaScript
- Stelle
- 13.8k
- Fork
- 658
- Merge medio
- 7g 5h
- PR unite (30g)
- 18
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di shipshapecode/shepherd
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
shipshapecode/shepherd#3505 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
shipshapecode/shepherd#3484 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
shipshapecode/shepherd#3478 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
shipshapecode/shepherd#3442 · 1 commento · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
shipshapecode/shepherd#3146 · 2 commenti ·
Tutte le issue di shipshapecode/shepherd
Issue simili
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Improve Title Support Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·