Skip to content

Commit

Permalink
Fix keyboard thumbnail activation (fixes #1068) (#1155)
Browse files Browse the repository at this point in the history
  • Loading branch information
danihagosbl authored Oct 23, 2024
1 parent b024fbf commit 0687aba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
$treeViewOptions: JQuery;
$treeSelect: JQuery;
$views: JQuery;
$keyElement: JQuery
expandFullEnabled: boolean = false;
galleryView: GalleryView;
isThumbsViewOpen: boolean = false;
isTreeViewOpen: boolean = false;
keyPress:boolean = false;
treeData: TreeNode;
treeSortType: TreeSortType = TreeSortType.NONE;
treeView: TreeView;
Expand Down Expand Up @@ -505,10 +507,12 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
onClick: (thumb: Thumb) => {
this.extensionHost.publish(IIIFEvents.THUMB_SELECTED, thumb);
},
onKeyDown: (thumb: Thumb) => {
this.extensionHost.publish(IIIFEvents.THUMB_SELECTED, thumb);
},
})
);
}

createGalleryView(): void {
this.galleryView = new GalleryView(this.$galleryView);
this.galleryView.galleryData = this.getGalleryData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import cx from "classnames";
const ThumbImage = ({
first,
onClick,
onKeyDown,
paged,
selected,
thumb,
viewingDirection,
}: {
first: boolean;
onClick: (thumb: Thumb) => void;
onKeyDown: (thumb: Thumb) => void;
paged: boolean;
selected: boolean;
thumb: Thumb;
Expand All @@ -28,6 +30,7 @@ const ThumbImage = ({
return (
<div
onClick={() => onClick(thumb)}
onKeyDown= {(e) => {if(e.key === 'Enter'){onKeyDown(thumb)}}}
className={cx("thumb", {
first: first,
placeholder: !thumb.uri,
Expand Down Expand Up @@ -64,12 +67,14 @@ const ThumbImage = ({

const Thumbnails = ({
onClick,
onKeyDown,
paged,
selected,
thumbs,
viewingDirection,
}: {
onClick: (thumb: Thumb) => void;
onKeyDown: (thumb: Thumb) => void;
paged: boolean;
selected: number[];
thumbs: Thumb[];
Expand Down Expand Up @@ -122,6 +127,7 @@ const Thumbnails = ({
<ThumbImage
first={index === firstNonPagedIndex}
onClick={onClick}
onKeyDown={onKeyDown}
paged={paged}
selected={selected.includes(index)}
thumb={thumb}
Expand Down

0 comments on commit 0687aba

Please sign in to comment.