Skip to content

Commit

Permalink
Fix left arrow selection on list nodes (#3575)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Dec 17, 2022
1 parent e9c87fb commit f9d2927
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/lexical-react/src/LexicalCheckListPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,21 @@ export function CheckListPlugin(): null {
anchorNode,
(node) => $isElementNode(node) && !node.isInline(),
);

if (
$isListItemNode(elementNode) &&
(isElement || elementNode.getFirstDescendant() === anchorNode)
) {
const domNode = editor.getElementByKey(elementNode.__key);

if (domNode != null && document.activeElement !== domNode) {
domNode.focus();
event.preventDefault();
return true;
if ($isListItemNode(elementNode)) {
const parent = elementNode.getParent();
if (
$isListNode(parent) &&
parent.getListType() === 'check' &&
(isElement ||
elementNode.getFirstDescendant() === anchorNode)
) {
const domNode = editor.getElementByKey(elementNode.__key);

if (domNode != null && document.activeElement !== domNode) {
domNode.focus();
event.preventDefault();
return true;
}
}
}
}
Expand Down

2 comments on commit f9d2927

@vercel
Copy link

@vercel vercel bot commented on f9d2927 Dec 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-git-main-fbopensource.vercel.app
www.lexical.dev
lexicaljs.org
lexical-fbopensource.vercel.app
lexical.dev
lexicaljs.com

@vercel
Copy link

@vercel vercel bot commented on f9d2927 Dec 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground-fbopensource.vercel.app
lexical-playground-git-main-fbopensource.vercel.app
lexical-playground.vercel.app
playground.lexical.dev

Please sign in to comment.