You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMO Google does it better, it allows setting both start and end, and also checks the cursor position.
In Lexical, the start position is below the element, while in Google it's on the left.
This is literally an issue where clicking above the horizontal rule brings your cursor down, and when you type, it shows the text above the horizontal rule.
I think the expected behavior here would be to have clicks be handled in the basically same way that the arrow keys are, where it will switch to a NodeSelection of the HorizontalRuleNode instead of a specific position before or after the node.
clicks already do this if you manage to click near enough to the displayed hr, there are just "empty" locations between the divider and any adjacent block element node that will end up being reconciled to a collapsed RangeSelection instead.
I think the expected behavior here would be to have clicks be handled in the basically same way that the arrow keys are, where it will switch to a NodeSelection of the HorizontalRuleNode instead of a specific position before or after the node.
The click-to-select functionality for the HorizontalRuleNode is already implemented and working correctly when clicking directly on the horizontal rule element itself. However, there are noticeable empty spaces above and below the HorizontalRuleNode where clicking doesn't trigger the selection mechanism, creating problematic dead zones for user interaction.
I've noticed that applying overflow: hidden to the root contenteditable div appears to prevent the caret from visually moving downward when clicking in these empty spaces. This CSS solution could serve as a workaround to contain the caret within the expected editing boundaries, though it's worth testing for potential side effects on scrolling behavior.
An alternative approach would be to implement a custom click event listener that calculates the click position relative to the HorizontalRuleNode and programmatically sets the selection to either the node immediately before or after it, depending on which is closer. This would provide more precise control over selection behavior in the problematic regions by leveraging Lexical's $createRangeSelection() and $setSelection() APIs to handle these edge cases explicitly.
I opened #9422 to fix this: clicking the empty space above or below a horizontal rule now selects the rule, as the arrow keys do. It hit-tests the click against the rules' own boxes (with margins), so it doesn't depend on where the browser puts the caret.
Activity
harshmetkel24 commentedon Aug 24, 2025
https://github.com/user-attachments/assets/2ce470e6-6216-4efc-9a59-2dbbc96d78c0
Even Google Docs seems to allow that. Someone from the Lexical team could confirm this behavior as wel
username14415 commentedon Aug 28, 2025
IMO Google does it better, it allows setting both start and end, and also checks the cursor position.
In Lexical, the start position is below the element, while in Google it's on the left.
niikkhilsharma commentedon Sep 30, 2025
This is literally an issue where clicking above the horizontal rule brings your cursor down, and when you type, it shows the text above the horizontal rule.
@etrepum
Can you please verify it that's an issue
etrepum commentedon Oct 1, 2025
I think the expected behavior here would be to have clicks be handled in the basically same way that the arrow keys are, where it will switch to a NodeSelection of the HorizontalRuleNode instead of a specific position before or after the node.
etrepum commentedon Oct 1, 2025
clicks already do this if you manage to click near enough to the displayed hr, there are just "empty" locations between the divider and any adjacent block element node that will end up being reconciled to a collapsed RangeSelection instead.
niikkhilsharma-f commentedon Oct 15, 2025
The click-to-select functionality for the HorizontalRuleNode is already implemented and working correctly when clicking directly on the horizontal rule element itself. However, there are noticeable empty spaces above and below the HorizontalRuleNode where clicking doesn't trigger the selection mechanism, creating problematic dead zones for user interaction.
I've noticed that applying overflow: hidden to the root contenteditable div appears to prevent the caret from visually moving downward when clicking in these empty spaces. This CSS solution could serve as a workaround to contain the caret within the expected editing boundaries, though it's worth testing for potential side effects on scrolling behavior.
niikkhilsharma-f commentedon Oct 15, 2025
An alternative approach would be to implement a custom click event listener that calculates the click position relative to the HorizontalRuleNode and programmatically sets the selection to either the node immediately before or after it, depending on which is closer. This would provide more precise control over selection behavior in the problematic regions by leveraging Lexical's $createRangeSelection() and $setSelection() APIs to handle these edge cases explicitly.
Vedthakar commentedon Oct 21, 2026
I opened #9422 to fix this: clicking the empty space above or below a horizontal rule now selects the rule, as the arrow keys do. It hit-tests the click against the rules' own boxes (with margins), so it doesn't depend on where the browser puts the caret.
— Ved Thakar