Skip to content

Commit

Permalink
Merge branch 'dev' into fix-issue-917
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Oct 31, 2024
2 parents 271bd31 + b98b70d commit 20097f8
Show file tree
Hide file tree
Showing 23 changed files with 20,056 additions and 11,892 deletions.
31,647 changes: 19,856 additions & 11,791 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
"@google/model-viewer": "^1.9.2",
"@iiif/base-component": "2.0.1",
"@iiif/iiif-av-component": "1.2.4",
"@iiif/iiif-gallery-component": "^1.1.21",
"@iiif/iiif-gallery-component": "^1.1.22",
"@iiif/iiif-metadata-component": "^1.1.19",
"@iiif/iiif-tree-component": "2.0.6",
"@iiif/manifold": "2.0.31",
"@iiif/manifold": "2.1.0",
"@iiif/presentation-3": "^1.0.5",
"@iiif/vocabulary": "^1.0.23",
"@openseadragon-imaging/openseadragon-viewerinputhook": "^2.2.1",
Expand All @@ -109,7 +109,7 @@
"jquery": "3.5.0",
"jsviews": "1.0.15",
"less-plugin-clean-css": "^1.5.1",
"manifesto.js": "4.2.17",
"manifesto.js": "4.2.20",
"mediaelement": "4.2.15",
"mediaelement-plugins": "2.5.1",
"openseadragon": "4.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/content-handlers/iiif/BaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export type CenterPanelOptions = {
export type CenterPanelContent = {
attribution: string;
close: string;
closeAttribution: string;
};

type CenterPanel = ModuleConfig & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"alephCenterPanel": {
Expand All @@ -213,7 +214,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"settingsDialogue": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"avCenterPanel": {
Expand All @@ -250,6 +251,7 @@
"content": {
"attribution": "$attribution",
"close": "$close",
"closeAttribution": "$closeAttribution",
"currentTime": "$currentTime",
"delimiter": " - ",
"duration": "$duration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"fileLinkCenterPanel": {
Expand All @@ -106,7 +107,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"footerPanel": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"ebookCenterPanel": {
Expand All @@ -208,7 +209,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"settingsDialogue": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"mediaelementCenterPanel": {
Expand All @@ -169,7 +170,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"restrictedDialogue": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"modelViewerCenterPanel": {
Expand All @@ -262,6 +263,7 @@
"content": {
"attribution": "$attribution",
"close": "$close",
"closeAttribution": "$closeAttribution",
"zoomIn": "$zoomIn",
"zoomOut": "$zoomOut",
"vr": "$vr"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"openSeadragonCenterPanel": {
Expand Down Expand Up @@ -365,6 +366,7 @@
"content": {
"attribution": "$attribution",
"close": "$close",
"closeAttribution": "$closeAttribution",
"goHome": "$goHome",
"imageUnavailable": "$imageUnavailable",
"next": "$next",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@
},
"content": {
"attribution": "$attribution",
"close": "$close"
"close": "$close",
"closeAttribution": "$closeAttribution"
}
},
"pdfCenterPanel": {
Expand All @@ -200,6 +201,7 @@
"content": {
"attribution": "$attribution",
"close": "$close",
"closeAttribution": "$closeAttribution",
"next": "$next",
"previous": "$previous"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class MoreInfoDialogue extends Dialogue<
);
this.$content.append(this.$title);

this.$metadata = $('<div class="iiif-metadata-component"></div>');
this.$metadata = $('<article class="iiif-metadata-component"></article>');
this.$content.append(this.$metadata);

this.metadataComponent = new MetadataComponent({
Expand Down Expand Up @@ -98,5 +98,18 @@ export class MoreInfoDialogue extends Dialogue<

resize(): void {
this.setDockedPosition();

// always put tabindex on, so the metadata is focusable,
// just in case there's something wrong with the height
// comparison below
this.$metadata.attr('tabindex', 0);
this.$metadata.attr('aria-label', this.config.content.title);

// if metadata's first group's height is lte than metadata (200px fixed I think),
// there's no scroll happening, so no focus needed, and no aria label either
if(this.$metadata.find('.groups').first().height() <= this.$metadata.height()) {
this.$metadata.removeAttr('tabindex');
this.$metadata.removeAttr('aria-label');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class MoreInfoRightPanel extends RightPanel<MoreInfoRightPanelConfig> {

this.setTitle(this.config.content.title);

this.$metadata = $('<div class="iiif-metadata-component"></div>');
this.$metadata = $('<article class="iiif-metadata-component"></article>');
this.$main.append(this.$metadata);

this.metadataComponent = new MetadataComponent({
Expand Down Expand Up @@ -141,5 +141,18 @@ export class MoreInfoRightPanel extends RightPanel<MoreInfoRightPanelConfig> {
this.$main.height(
this.$element.height() - this.$top.height() - this.$main.verticalMargins()
);

// always put tabindex on, so the main is focusable,
// just in case there's something wrong with the height
// comparison below
this.$main.attr('tabindex', 0);
this.$main.attr('aria-label', this.config.content.title);

// if metadata's height lte main's, no scroll, so no focus needed
// and no aria label either
if(this.$metadata.height() <= this.$main.height()) {
this.$main.removeAttr('tabindex');
this.$main.removeAttr('aria-label');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class OpenSeadragonCenterPanel extends CenterPanel<

updateResponsiveView(): void {
this.setNavigatorVisible();
this.viewer.autoHideControls = true;
this.viewer.autoHideControls = this.extension.isDesktopMetric();

const enableAutoHide = (event: JQuery.FocusOutEvent) => {
this.viewer.autoHideControls = true;
Expand Down Expand Up @@ -360,40 +360,52 @@ export class OpenSeadragonCenterPanel extends CenterPanel<
],
});

this.$zoomInButton = this.$viewer.find('div[title="Zoom in"]');
let $oldZoomIn = this.$viewer.find('div[title="Zoom in"]');
this.$zoomInButton = $("<button />").append($oldZoomIn.contents());
this.$zoomInButton.insertAfter($oldZoomIn);
$oldZoomIn.remove();
this.$zoomInButton.attr("tabindex", 0);
this.$zoomInButton.prop("title", this.content.zoomIn);
this.$zoomInButton.prop("aria-label", this.content.zoomIn);
this.$zoomInButton.attr("title", this.content.zoomIn);
this.$zoomInButton.attr("aria-label", this.content.zoomIn);
this.$zoomInButton.addClass("zoomIn viewportNavButton");

this.onAccessibleClick(this.$zoomInButton, () => {
this.zoomIn();
});

this.$zoomOutButton = this.$viewer.find('div[title="Zoom out"]');
let $oldZoomOut = this.$viewer.find('div[title="Zoom out"]');
this.$zoomOutButton = $("<button />").append($oldZoomOut.contents());
this.$zoomOutButton.insertAfter($oldZoomOut);
$oldZoomIn.remove();
this.$zoomOutButton.attr("tabindex", 0);
this.$zoomOutButton.prop("title", this.content.zoomOut);
this.$zoomOutButton.prop("aria-label", this.content.zoomOut);
this.$zoomOutButton.attr("title", this.content.zoomOut);
this.$zoomOutButton.attr("aria-label", this.content.zoomOut);
this.$zoomOutButton.addClass("zoomOut viewportNavButton");

this.onAccessibleClick(this.$zoomOutButton, () => {
this.zoomOut();
});

this.$goHomeButton = this.$viewer.find('div[title="Go home"]');
let $oldGoHome = this.$viewer.find('div[title="Go home"]');
this.$goHomeButton = $("<button />").append($oldGoHome.contents());
this.$goHomeButton.insertAfter($oldGoHome);
$oldGoHome.remove();
this.$goHomeButton.attr("tabindex", 0);
this.$goHomeButton.prop("title", this.content.goHome);
this.$goHomeButton.prop("aria-label", this.content.goHome);
this.$goHomeButton.attr("title", this.content.goHome);
this.$goHomeButton.attr("aria-label", this.content.goHome);
this.$goHomeButton.addClass("goHome viewportNavButton");

this.onAccessibleClick(this.$goHomeButton, () => {
this.goHome();
});

this.$rotateButton = this.$viewer.find('div[title="Rotate right"]');
let $oldRotate = this.$viewer.find('div[title="Rotate right"]');
this.$rotateButton = $("<button />").append($oldRotate.contents());
this.$rotateButton.insertAfter($oldRotate);
$oldRotate.remove();
this.$rotateButton.attr("tabindex", 0);
this.$rotateButton.prop("title", this.content.rotateRight);
this.$rotateButton.prop("aria-label", this.content.rotateRight);
this.$rotateButton.attr("title", this.content.rotateRight);
this.$rotateButton.attr("aria-label", this.content.rotateRight);
this.$rotateButton.addClass("rotate viewportNavButton");

this.onAccessibleClick(this.$rotateButton, () => {
Expand All @@ -402,8 +414,10 @@ export class OpenSeadragonCenterPanel extends CenterPanel<

if (this.showAdjustImageButton) {
this.$adjustImageButton = this.$rotateButton.clone();
this.$adjustImageButton.prop('title', this.content.adjustImage);
this.$adjustImageButton.attr('title', this.content.adjustImage);
this.$adjustImageButton.attr('aria-label', this.content.adjustImage);
this.$adjustImageButton.switchClass('rotate', 'adjustImage');
this.$adjustImageButton.attr('tabindex', 0);
this.$adjustImageButton.onPressed(() => {
this.extensionHost.publish(IIIFEvents.SHOW_ADJUSTIMAGE_DIALOGUE);
});
Expand All @@ -414,6 +428,22 @@ export class OpenSeadragonCenterPanel extends CenterPanel<
});
}

this.$zoomInButton
.add(this.$zoomOutButton)
.add(this.$goHomeButton)
.add(this.$rotateButton)
.add(this.$adjustImageButton).on('focus', () => {
if (this.controlsVisible) return;
this.controlsVisible = true;
this.viewer.setControlsEnabled(true);
});

this.$zoomInButton.add(this.$adjustImageButton).on('blur', () => {
if (!this.controlsVisible) return;
this.controlsVisible = false;
this.viewer.setControlsEnabled(false);
});

this.$viewportNavButtonsContainer = this.$viewer.find(
".openseadragon-container > div:not(.openseadragon-canvas):first"
);
Expand Down Expand Up @@ -622,16 +652,16 @@ export class OpenSeadragonCenterPanel extends CenterPanel<
});

// When Prev/Next buttons are focused, make sure the controls are enabled
this.$prevButton.on("focus", () => {
this.$prevButton.add(this.$nextButton).on("focus", () => {
if (this.controlsVisible) return;
this.controlsVisible = true;
this.viewer.setControlsEnabled(true);
});

this.$nextButton.on("focus", () => {
if (this.controlsVisible) return;
this.controlsVisible = true;
this.viewer.setControlsEnabled(true);
this.$prevButton.add(this.$nextButton).on("blur", () => {
if (!this.controlsVisible) return;
this.controlsVisible = false;
this.viewer.setControlsEnabled(false);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class CenterPanel<
this.closeAttribution();

this.$closeAttributionButton = this.$attribution.find(".header .close");
this.$closeAttributionButton.attr("aria-label", this.content.close);
this.$closeAttributionButton.attr("aria-label", this.content.closeAttribution);
this.$closeAttributionButton.on("click", (e) => {
e.preventDefault();
this.closeAttribution();
Expand Down
Loading

0 comments on commit 20097f8

Please sign in to comment.