feat(experience-lwc-generate): add native lightning/modal example, ma… - #321
Open
bfmvsa wants to merge 1 commit into
Open
feat(experience-lwc-generate): add native lightning/modal example, ma…#321bfmvsa wants to merge 1 commit into
bfmvsa wants to merge 1 commit into
Conversation
…rk custom composable modal as fallback
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.
What changed
Added a new
assets/native-modal-component/bundle toexperience-lwc-generate(nativeModalComponent.js,.html,.js-meta.xml) demonstrating the nativelightning/modalservice (LightningModal) — header/body/footer vialightning-modal-*subcomponents,@apiinputs, and explicitclose()per action, with a usage snippet showing how a parent opens it viaYourModalName.open({...}).Updated
SKILL.md's asset index andreferences/component-patterns.md's Modal Component Pattern section to list the native modal as the default pattern, and re-labeled the existing hand-rolled composable modal (assets/modal-component/) as a fallback for caseslightning/modalcan't cover.Why
The existing modal asset only showed a ~200-line custom composable modal (focus trap, ESC handling, backdrop) based on an older blog pattern, even though this skill's own reference doc already lists
lightning/modalas the native solution and says "avoid reinventing what base components already provide." The custom pattern also passes a save handler as a function reference via@api, which doesn't work when the component sits on an Aura-based Experience Builder page. Nativelightning/modalgets focus trap, ESC-to-close, ARIA, and size variants for free, and current Salesforce docs confirm it's usable in Aura-based Experience Builder sites, so it should be the default example rather than the fallback.Notes
assets/modal-component/, since it's still useful wherelightning/modalisn't available (e.g. an unconfirmed gap on some LWR site templates) — flagged it as fallback instead of deleting it.lightning/modalbehavior on their site template of choice.@api modalSaveHandleranti-pattern in the existing custom modal — left as a follow-up since fixing it means changing that component's public API.Skills
Manual checklist
Description quality
Instructions
Context efficiency
templates/,examples/, ordocs/subdirectoriesAutomated checks
Enforced by CI (
npm run validate:skills) per the Agent Skills spec:SKILL.mdnamematches directory name;descriptionis present, ≥ 20 words, ≤ 1024 characters, and includes trigger language