diff --git a/src/screens/Notifications/components/NotificationItem/Item/Root.tsx b/src/screens/Notifications/components/NotificationItem/Item/Root.tsx
index 1117bef59..074564eaf 100644
--- a/src/screens/Notifications/components/NotificationItem/Item/Root.tsx
+++ b/src/screens/Notifications/components/NotificationItem/Item/Root.tsx
@@ -1,4 +1,4 @@
-import {createContext, useContext, useState} from 'react'
+import {createContext, useContext} from 'react'
import {
type AccessibilityActionEvent,
type AccessibilityProps,
@@ -13,6 +13,7 @@ import {WebAuxClickWrapper} from '#/view/com/util/WebAuxClickWrapper'
import {atoms as a, select, useTheme} from '#/alf'
import {useLink} from '#/components/Link'
import {SubtleHover} from '#/components/SubtleHover'
+import {SuppressHoverContext, useRowHover} from './hover'
type ItemContextValue = {
isRead: boolean
@@ -114,49 +115,50 @@ export function Root({
children: React.ReactNode
}) {
const backgroundColor = useRowBackgroundColor(isRead)
- const [hover, setHover] = useState(false)
+ const {hover, hoverProps, setSuppressed} = useRowHover()
const {onPress: followLink} = useLink({to: href, displayText: ''})
return (
-
- {
- if (onPressProp) {
- onPressProp(event)
- return
- }
- onBeforePress?.()
- followLink(event)
- }}
- onPointerEnter={() => setHover(true)}
- onPointerLeave={() => setHover(false)}
- style={[
- a.flex_row,
- a.align_start,
- a.gap_lg,
- /*
- * As a button it's a `
-
+
+
+ {
+ if (onPressProp) {
+ onPressProp(event)
+ return
+ }
+ onBeforePress?.()
+ followLink(event)
+ }}
+ {...hoverProps}
+ style={[
+ a.flex_row,
+ a.align_start,
+ a.gap_lg,
+ /*
+ * As a button it's a `
+
+
)
}
diff --git a/src/screens/Notifications/components/NotificationItem/Item/hover.tsx b/src/screens/Notifications/components/NotificationItem/Item/hover.tsx
new file mode 100644
index 000000000..0ad184ae3
--- /dev/null
+++ b/src/screens/Notifications/components/NotificationItem/Item/hover.tsx
@@ -0,0 +1,41 @@
+import {createContext, useContext, useState} from 'react'
+
+/**
+ * Lets a control nested in a row, e.g. a follow button, switch off the row's
+ * hover highlight while the control itself is hovered, so that it reads as a
+ * target of its own rather than as part of the row.
+ */
+export const SuppressHoverContext = createContext<
+ (suppressed: boolean) => void
+>(() => {})
+
+export function useSuppressHover() {
+ return useContext(SuppressHoverContext)
+}
+
+/**
+ * Hover state for a row, which is `hover` unless a nested control has
+ * suppressed it. Spread `hoverProps` onto the row, and provide `setSuppressed`
+ * through `SuppressHoverContext`.
+ *
+ * The row stays hovered while the pointer is over a nested control, so a
+ * control can't clear it by itself.
+ */
+export function useRowHover() {
+ const [hovered, setHovered] = useState(false)
+ const [suppressed, setSuppressed] = useState(false)
+
+ return {
+ hover: hovered && !suppressed,
+ setSuppressed,
+ hoverProps: {
+ onPointerEnter: () => setHovered(true),
+ // Also clears a control that unmounted while hovered, so it can't leave
+ // the row stuck without a highlight
+ onPointerLeave: () => {
+ setHovered(false)
+ setSuppressed(false)
+ },
+ },
+ }
+}
diff --git a/src/screens/Notifications/components/NotificationItem/Item/profile.tsx b/src/screens/Notifications/components/NotificationItem/Item/profile.tsx
index cf5709a23..1ce4ffc02 100644
--- a/src/screens/Notifications/components/NotificationItem/Item/profile.tsx
+++ b/src/screens/Notifications/components/NotificationItem/Item/profile.tsx
@@ -41,6 +41,7 @@ import {type Metrics} from '#/analytics'
import {app} from '#/lexicons'
import * as bsky from '#/types/bsky'
import {AVATAR_SLOT_WIDTH} from './Avatar'
+import {SuppressHoverContext, useRowHover, useSuppressHover} from './hover'
import {Card} from './media'
import {useDisplayName} from './text'
@@ -79,6 +80,7 @@ function PillButton({
onPress: (event: GestureResponderEvent) => void
}) {
const t = useTheme()
+ const suppressHover = useSuppressHover()
return (