Fix(Forms): Defer MarkdownEditor initialization in collapsed sections and hidden containers - #20314
Closed
hamdyelbatal122 wants to merge 2 commits into
Closed
Conversation
hamdyelbatal122
force-pushed
the
fix/issue-20313-markdown-editor-collapsed
branch
2 times, most recently
from
August 1, 2026 04:11
1495b26 to
9512447
Compare
Contributor
Author
|
Updated the PR to fix the issue across all collapsed containers (
|
|
I tested the fix in my reproduction repo and can confirm it's working as expected. https://github.com/outatime-io/filament-collapsed-markdown-editor-reproduction |
3 tasks
Member
|
#20320 fixes all problems at the root cause |
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.
Fixes #20313
Cause
When a
MarkdownEditorcomponent is placed inside a collapsedSectionor an inactive tab/container,EasyMDE(CodeMirror 5) eagerly attempts to measure character coordinates while the element has no rendered DOM dimensions (visibility: hiddenorheight: 0). This triggersTypeError: Cannot read properties of null (reading 'top')orTypeError: Cannot read properties of undefined (reading 'map').Solution
markdownEditorFormComponentto inspect container visibility oninit(). If the editor starts inside a hidden/collapsed container,EasyMDEinstantiation is deferred until the section is expanded and revealed viaResizeObserver.CodeMirror.defineInitHookinmarkdown-editor.jsto prevent unhandled selection measurement errors on zero-rect elements beforerefresh()runs.