chore: tag context menu focus [skip e2e]
This commit is contained in:
@@ -16,6 +16,7 @@ type Props = {
|
|||||||
useIconGrid?: boolean
|
useIconGrid?: boolean
|
||||||
iconGridClassName?: string
|
iconGridClassName?: string
|
||||||
className?: string
|
className?: string
|
||||||
|
autoFocus?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const TabButton = forwardRef(
|
const TabButton = forwardRef(
|
||||||
@@ -51,7 +52,15 @@ const TabButton = forwardRef(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const IconPicker = ({ selectedValue, onIconChange, platform, className, useIconGrid, iconGridClassName }: Props) => {
|
const IconPicker = ({
|
||||||
|
selectedValue,
|
||||||
|
onIconChange,
|
||||||
|
platform,
|
||||||
|
className,
|
||||||
|
useIconGrid,
|
||||||
|
iconGridClassName,
|
||||||
|
autoFocus,
|
||||||
|
}: Props) => {
|
||||||
const iconKeys = useMemo(() => Object.keys(IconNameToSvgMapping), [])
|
const iconKeys = useMemo(() => Object.keys(IconNameToSvgMapping), [])
|
||||||
|
|
||||||
const iconOptions = useMemo(
|
const iconOptions = useMemo(
|
||||||
@@ -156,7 +165,7 @@ const IconPicker = ({ selectedValue, onIconChange, platform, className, useIconG
|
|||||||
<DecoratedInput
|
<DecoratedInput
|
||||||
ref={emojiInputRef}
|
ref={emojiInputRef}
|
||||||
autocomplete={false}
|
autocomplete={false}
|
||||||
autofocus={emojiInputFocused}
|
autofocus={autoFocus ?? emojiInputFocused}
|
||||||
type="text"
|
type="text"
|
||||||
value={emojiInputValue as string}
|
value={emojiInputValue as string}
|
||||||
onChange={(value) => handleEmojiChange(value)}
|
onChange={(value) => handleEmojiChange(value)}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import { useCallback, useMemo, useRef } from 'react'
|
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
||||||
import Icon from '@/Components/Icon/Icon'
|
import Icon from '@/Components/Icon/Icon'
|
||||||
import Menu from '@/Components/Menu/Menu'
|
import Menu from '@/Components/Menu/Menu'
|
||||||
import MenuItem from '@/Components/Menu/MenuItem'
|
import MenuItem from '@/Components/Menu/MenuItem'
|
||||||
@@ -61,6 +61,13 @@ const TagContextMenu = ({ navigationController, isEntitledToFolders, selectedTag
|
|||||||
const tagCreatedAt = useMemo(() => formatDateForContextMenu(selectedTag.created_at), [selectedTag.created_at])
|
const tagCreatedAt = useMemo(() => formatDateForContextMenu(selectedTag.created_at), [selectedTag.created_at])
|
||||||
|
|
||||||
const titleInputRef = useRef<HTMLInputElement>(null)
|
const titleInputRef = useRef<HTMLInputElement>(null)
|
||||||
|
useEffect(() => {
|
||||||
|
if (contextMenuOpen) {
|
||||||
|
setTimeout(() => {
|
||||||
|
titleInputRef.current?.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [contextMenuOpen])
|
||||||
|
|
||||||
const saveTitle = useCallback(
|
const saveTitle = useCallback(
|
||||||
(closeMenu = false) => {
|
(closeMenu = false) => {
|
||||||
@@ -125,6 +132,7 @@ const TagContextMenu = ({ navigationController, isEntitledToFolders, selectedTag
|
|||||||
className={'py-1.5 md:px-3'}
|
className={'py-1.5 md:px-3'}
|
||||||
useIconGrid={true}
|
useIconGrid={true}
|
||||||
iconGridClassName="max-h-30"
|
iconGridClassName="max-h-30"
|
||||||
|
autoFocus={false}
|
||||||
/>
|
/>
|
||||||
<MenuSection>
|
<MenuSection>
|
||||||
{application.featuresController.isVaultsEnabled() && (
|
{application.featuresController.isVaultsEnabled() && (
|
||||||
|
|||||||
Reference in New Issue
Block a user