Repository navigation
[lexical-website] Documentation Update: point the selection guide at NodeCaret - #9229
Merged
Merged
Conversation
…NodeCaret ## Description `concepts/selection.md` explains selection without ever mentioning the caret model, and its only cross-link is to the Shadow DOM page. NodeCaret is the API for traversing from a selection point — it has its own page, it is what `LexicalSelection` is built on internally, and `lexical` exports `$caretRangeFromSelection` / `$setSelectionFromCaretRange` to convert between the two. A reader who needs to walk the document from a selection currently has no path from this page to that one. This adds a tip in "Working with selection" naming the page and the two conversion helpers. No existing text changes. ## Test plan Documentation-only change (markdown is excluded from prettier via `.prettierignore`), so the check is that the link and the named exports resolve. ### Before ``` $ grep -c "traversals\|NodeCaret" packages/lexical-website/docs/concepts/selection.md 0 $ grep -c "Caret" packages/lexical/src/LexicalSelection.ts 99 ``` The page a reader needs is unreachable from the one they are on. ### After ``` $ grep -n "traversals\|caretRangeFromSelection" packages/lexical-website/docs/concepts/selection.md 68:[Node Traversals with NodeCaret](./traversals.md). 69:`$caretRangeFromSelection(selection)` converts a `RangeSelection` into the 71:`$setSelectionFromCaretRange(range)` converts back. $ ls packages/lexical-website/docs/concepts/traversals.md packages/lexical-website/docs/concepts/traversals.md $ grep -n "caretRangeFromSelection\|setSelectionFromCaretRange" packages/lexical/src/index.ts 55: $caretRangeFromSelection, 66: $setSelectionFromCaretRange, ``` Both helpers are exported from `lexical` (`packages/lexical/src/caret/LexicalCaretUtils.ts:133,162`), and `traversals.md` documents the range type they produce.
potatowagon
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7 and
zurfyx
as code owners
September 24, 2026 16:47
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 24, 2026
Merged
This branch was successfully deployed
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.
Description
concepts/selection.mdexplains selection without ever mentioning the caretmodel, and its only cross-link is to the Shadow DOM page. NodeCaret is the
API for traversing from a selection point — it has its own page, it is what
LexicalSelectionis built on internally, andlexicalexports$caretRangeFromSelection/$setSelectionFromCaretRangeto convert betweenthe two. A reader who needs to walk the document from a selection currently
has no path from this page to that one.
This adds a tip in "Working with selection" naming the page and the two
conversion helpers. No existing text changes.
Test plan
Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the link and the named exportsresolve.
Before
The page a reader needs is unreachable from the one they are on.
After
Both helpers are exported from
lexical(
packages/lexical/src/caret/LexicalCaretUtils.ts:133,162), andtraversals.mddocuments the range type they produce.