fix(ux): remove highlight boundary when using mouse

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-05-22 13:53:43 +08:00
parent 582303fcbf
commit 26c64bf040
3 changed files with 31 additions and 19 deletions
@@ -100,10 +100,15 @@ export const EntryColumnShortcutHandler: FC<{
const $scrollArea = useScrollViewElement()
const { highlightBoundary } = useFocusActions()
useEffect(() => {
return EventBus.subscribe(COMMAND_ID.layout.focusToTimeline, () => {
$scrollArea?.focus()
nextFrame(highlightBoundary)
})
return EventBus.subscribe(
COMMAND_ID.layout.focusToTimeline,
({ highlightBoundary: highlight }) => {
$scrollArea?.focus()
if (highlight) {
nextFrame(highlightBoundary)
}
},
)
}, [$scrollArea, highlightBoundary])
const isFocusIn = useFocusable()
@@ -104,7 +104,7 @@ export const EntryContent: Component<EntryContentProps> = ({
useEffect(() => {
if (prevEntryId.current !== entryId) {
springScrollTo(0, scrollerRef.current!)
scrollerRef.current?.scrollTo({ top: 0 })
animationController.start(pageMotionVariants.exit).then(() => {
animationController.start(pageMotionVariants.animate)
})
@@ -412,16 +412,21 @@ const RegisterCommands = ({
}
checkScrollBottom($scroller)
}),
EventBus.subscribe(COMMAND_ID.layout.focusToEntryRender, () => {
const $scroller = scrollerRef.current
if (!$scroller) {
return
}
springScrollTo(0, $scroller)
$scroller.focus()
nextFrame(highlightBoundary)
setIsUserInteraction(true)
}),
EventBus.subscribe(
COMMAND_ID.layout.focusToEntryRender,
({ highlightBoundary: highlight }) => {
const $scroller = scrollerRef.current
if (!$scroller) {
return
}
springScrollTo(0, $scroller)
$scroller.focus()
if (highlight) {
nextFrame(highlightBoundary)
}
setIsUserInteraction(true)
},
),
)
}, [highlightBoundary, scrollerRef, setIsUserInteraction])
@@ -379,11 +379,13 @@ const useRegisterCommand = () => {
EventBus.subscribe(COMMAND_ID.subscription.previousSubscription, () => {
handleSubscriptionNavigation("previous")
}),
EventBus.subscribe(COMMAND_ID.layout.focusToSubscription, () => {
EventBus.subscribe(COMMAND_ID.layout.focusToSubscription, ({ highlightBoundary }) => {
focusableContainerRef.current?.focus()
nextFrame(() => {
focusActions.highlightBoundary()
})
if (highlightBoundary) {
nextFrame(() => {
focusActions.highlightBoundary()
})
}
}),
EventBus.subscribe(COMMAND_ID.subscription.toggleFolderCollapse, () => {
const result = getCurrentActiveSubscriptionElement()