Repository navigation
docs: nest guide 06 modals inside the root element - #170
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #170 +/- ##
=======================================
Coverage 84.74% 84.74%
=======================================
Files 169 169
Lines 21588 21588
=======================================
Hits 18295 18295
Misses 2633 2633
Partials 660 660 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
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.
Two snippets in the state guide, the one under "Driving a Modal with State" and the complete example, put the
<modal>after the closing tag of the templ's root<div>. A templ only returns its first top-level element, but the generator still emits the rest, so the modal mounted, registered as an overlay and drew on screen while never joining the element tree. Its buttons were never registered as focusable, and Enter, Escape, Tab and clicks all went nowhere. In the first snippet that leaves the dialog stuck open, since Escape is bound to quit.Both snippets now nest the modal inside the root div, the same shape as examples/06-state, and a short note after the first one calls out the pitfall. Guide 09 had the same problem and #168 fixes it. I swept the remaining guides for the pattern and for anything that fails to generate or vet, and these were the only two. #169 tracks an analyzer error for templ bodies with more than one top-level element so this cannot pass
tui checkagain.The complete example also claimed its reset handler batched the two state writes, in the intro sentence and in a comment, while the code makes plain
Set()calls like examples/06-state does. The claim is gone; the batching section above it still shows the realapp.Batch()form.