@linktr.ee/messaging-react 1.21.0 → 1.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.21.0",
3
+ "version": "1.21.1",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -262,7 +262,8 @@ export const WithCustomMessagePreview: StoryFn = () => {
262
262
  participantName: 'Alice Urgent',
263
263
  participantId: 'participant-urgent',
264
264
  participantImage: 'https://i.pravatar.cc/150?img=36',
265
- lastMessageText: 'Critical issue needs immediate attention!',
265
+ lastMessageText:
266
+ 'Critical issue needs immediate attention! Please review the server logs for more details and escalate to the on-call engineer. This system outage is affecting multiple users, and we need to resolve it as soon as possible. Impacted services include messaging, notifications, and real-time updates. All hands are required to investigate and remediate the situation. If you have any questions or need additional resources, contact the incident commander immediately!',
266
267
  lastMessageTime: new Date(Date.now() - 1000 * 60), // 1 minute ago
267
268
  lastMessageMetadata: { custom_type: 'MESSAGE_URGENT' },
268
269
  unreadCount: 3,
@@ -36,6 +36,15 @@ const CustomChannelPreview = React.memo<CustomChannelPreviewProps>(
36
36
  onChannelSelect(channel)
37
37
  }
38
38
  }
39
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
40
+ const isActivationKey = event.key === 'Enter' || event.key === ' '
41
+ const isRepeatedKeydown = event.repeat
42
+
43
+ if (!isActivationKey || isRepeatedKeydown) return
44
+
45
+ event.preventDefault()
46
+ handleClick()
47
+ }
39
48
 
40
49
  // Get participant info
41
50
  const members = Object.values(channel?.state?.members || {})
@@ -96,9 +105,11 @@ const CustomChannelPreview = React.memo<CustomChannelPreviewProps>(
96
105
  }
97
106
 
98
107
  return (
99
- <button
100
- type="button"
108
+ <div
109
+ role="button"
110
+ tabIndex={0}
101
111
  onClick={handleClick}
112
+ onKeyDown={handleKeyDown}
102
113
  className={classNames(
103
114
  'group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring',
104
115
  {
@@ -149,7 +160,7 @@ const CustomChannelPreview = React.memo<CustomChannelPreviewProps>(
149
160
  </div>
150
161
  </div>
151
162
  </div>
152
- </button>
163
+ </div>
153
164
  )
154
165
  }
155
166
  )