@@ -148,6 +148,10 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
148
148
const selected = selectedIds . includes ( sandbox . id ) ;
149
149
const isDragging = isAnythingDragging && selected ;
150
150
151
+ const sandboxAnalyticsEvent = ! autoFork
152
+ ? MAP_SANDBOX_EVENT_TO_PAGE_TYPE [ page ]
153
+ : null ;
154
+
151
155
const onClick = event => {
152
156
onSelectionClick ( event , sandbox . id ) ;
153
157
} ;
@@ -169,10 +173,6 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
169
173
return ;
170
174
}
171
175
172
- const sandboxAnalyticsEvent = ! autoFork
173
- ? MAP_SANDBOX_EVENT_TO_PAGE_TYPE [ page ]
174
- : null ;
175
-
176
176
// Templates in Home should fork, everything else opens
177
177
if ( event . ctrlKey || event . metaKey ) {
178
178
if ( autoFork ) {
@@ -246,32 +246,35 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
246
246
onSubmit ( ) ;
247
247
} , [ onSubmit ] ) ;
248
248
249
+ const baseInteractions = {
250
+ selected,
251
+ onBlur,
252
+ onContextMenu,
253
+ } ;
249
254
const interactionProps =
250
255
page === 'recent'
251
256
? {
252
- selected,
253
- as : Link ,
254
- to : url ,
257
+ ...baseInteractions ,
258
+ as : sandbox . isV2 ? 'a' : Link ,
259
+ to : sandbox . isV2 ? undefined : url ,
260
+ href : sandbox . isV2 ? url : undefined ,
261
+ onClick : ( ) => {
262
+ if ( sandboxAnalyticsEvent ) {
263
+ trackImprovedDashboardEvent ( sandboxAnalyticsEvent ) ;
264
+ }
265
+ } ,
255
266
style : {
256
267
outline : 'none' ,
257
268
textDecoration : 'none' ,
258
269
} ,
259
- onBlur,
260
- onContextMenu,
261
270
}
262
271
: {
263
- tabIndex : 0 , // make div focusable
264
- style : {
265
- outline : 'none' ,
266
- } , // we handle outline with border
267
- selected,
272
+ ...baseInteractions ,
273
+ // Recent page does not support selection
274
+ 'data-selection-id' : sandbox . id ,
268
275
onClick,
269
276
onMouseDown,
270
277
onDoubleClick,
271
- onContextMenu,
272
- onBlur,
273
- // Recent page does not support selection
274
- 'data-selection-id' : sandbox . id ,
275
278
} ;
276
279
277
280
const sandboxProps = {
0 commit comments