fix: e shortcut to edit doesn't work when title is selected

closes #1510
This commit is contained in:
Tom Moor 2020-09-04 12:42:41 -07:00
parent e8648d4611
commit 9049785d98

View File

@ -41,7 +41,11 @@ class DocumentEditor extends React.Component<Props> {
}; };
handleTitleKeyDown = (event: SyntheticKeyboardEvent<>) => { handleTitleKeyDown = (event: SyntheticKeyboardEvent<>) => {
if (event.key === "Enter" || event.key === "Tab") { if (
event.key === "Enter" ||
event.key === "Tab" ||
event.key === "ArrowDown"
) {
event.preventDefault(); event.preventDefault();
this.focusAtStart(); this.focusAtStart();
} }
@ -78,6 +82,7 @@ class DocumentEditor extends React.Component<Props> {
value={!title && readOnly ? document.titleWithDefault : title} value={!title && readOnly ? document.titleWithDefault : title}
style={startsWithEmojiAndSpace ? { marginLeft: "-1.2em" } : undefined} style={startsWithEmojiAndSpace ? { marginLeft: "-1.2em" } : undefined}
readOnly={readOnly} readOnly={readOnly}
disabled={readOnly}
autoFocus={!title} autoFocus={!title}
maxLength={100} maxLength={100}
/> />