@@ -93,6 +93,13 @@ interface Props {
9393 * @default false
9494 */
9595 sharedView? : boolean ;
96+
97+ /**
98+ * Whether the card is clickable for keyboard navigation
99+ * @type {boolean}
100+ * @default false
101+ */
102+ clickable? : boolean ;
96103}
97104
98105const props = withDefaults (defineProps <Props >(), {
@@ -102,6 +109,7 @@ const props = withDefaults(defineProps<Props>(), {
102109 selectable: false ,
103110 selected: false ,
104111 sharedView: false ,
112+ clickable: false ,
105113});
106114
107115const router = useRouter ();
@@ -144,6 +152,18 @@ const emit = defineEmits<{
144152 * @event updateFilter
145153 */
146154 (e : " updateFilter" , key : string , value : any ): void ;
155+
156+ /**
157+ * Emitted when a keyboard event occurs on the history card
158+ * @event on-key-down
159+ */
160+ (e : " on-key-down" , history : AnyHistoryEntry , event : KeyboardEvent ): void ;
161+
162+ /**
163+ * Emitted when the history card is clicked
164+ * @event on-history-card-click
165+ */
166+ (e : " on-history-card-click" , history : AnyHistoryEntry , event : Event ): void ;
147167}>();
148168
149169/**
@@ -203,12 +223,25 @@ async function onTagsUpdate(historyId: string, tags: string[]) {
203223 await historyStore .updateHistory (historyId , { tags: tags });
204224 emit (" refreshList" , true , true );
205225}
226+
227+ function onClick(event : Event ) {
228+ if (props .clickable ) {
229+ emit (" on-history-card-click" , props .history , event );
230+ }
231+ }
232+
233+ function onKeyDown(event : KeyboardEvent ) {
234+ if (props .clickable ) {
235+ emit (" on-key-down" , props .history , event );
236+ }
237+ }
206238 </script >
207239
208240<template >
209241 <GCard
210242 :id =" `history-${history.id}`"
211243 :key =" history.id"
244+ class =" history-card"
212245 :title =" historyCardTitle"
213246 :title-badges =" historyCardTitleBadges"
214247 :title-n-lines =" 2"
@@ -226,11 +259,14 @@ async function onTagsUpdate(historyId: string, tags: string[]) {
226259 :tags-editable =" userOwnsHistory(currentUser, history)"
227260 :max-visible-tags =" props.gridView ? 2 : 8"
228261 :update-time =" history.update_time"
262+ :clickable =" props.clickable"
229263 @titleClick =" onTitleClick"
230264 @rename =" () => router.push(`/histories/rename?id=${history.id}`)"
231265 @select =" isMyHistory(history) && emit('select', history)"
232266 @tagsUpdate =" (tags) => onTagsUpdate(history.id, tags)"
233- @tagClick =" (tag) => emit('tagClick', tag)" >
267+ @tagClick =" (tag) => emit('tagClick', tag)"
268+ @click =" onClick"
269+ @keydown =" onKeyDown" >
234270 <template v-if =" props .archivedView && isArchivedHistory (history )" v-slot :titleActions >
235271 <ExportRecordDOILink :export-record-uri =" history.export_record_data?.target_uri" />
236272 </template >
0 commit comments