Skip to content

Commit

Permalink
fix(custom_logo): Internationalize alternative image text
Browse files Browse the repository at this point in the history
  • Loading branch information
tille committed Apr 9, 2021
1 parent 3caf809 commit 2762678
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/i18n/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ print_loading=Preparing to print...
print_ready=Ready to print.
# Accessible text for right navigation arrow that navigates user to previous file in collection
previous_file=Previous file
# Alternative text for logo-image
logo=Logo
# Accessible text for right navigation arrow that navigates user to next file in collection
next_file=Next file
# Text shown while preview is loading
Expand Down
12 changes: 9 additions & 3 deletions src/lib/PreviewUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class PreviewUI {
/** @property {HTMLElement} - Preview container element which houses the sidebar and content */
previewContainer;

/** @property {HTMLElement} - Preview container element which houses the custom-logo */
customLogoEl;

/**
* Destroy preview container content.
*
Expand Down Expand Up @@ -112,6 +115,10 @@ class PreviewUI {
this.container = this.container.querySelector(SELECTOR_BOX_PREVIEW_CONTAINER);
this.previewContainer = this.container.querySelector(SELECTOR_BOX_PREVIEW);
this.contentContainer = this.container.querySelector(SELECTOR_BOX_PREVIEW_CONTENT);
this.customLogoEl = this.container.querySelector(SELECTOR_BOX_PREVIEW_LOGO_CUSTOM);

// Set alternative accesible text
this.customLogoEl.setAttribute('alt', __('logo'));

// Setup the header, buttons, and theme
if (options.header !== 'none') {
Expand Down Expand Up @@ -385,9 +392,8 @@ class PreviewUI {
const defaultLogoEl = headerEl.querySelector(SELECTOR_BOX_PREVIEW_LOGO_DEFAULT);
defaultLogoEl.classList.add(CLASS_HIDDEN);

const customLogoEl = headerEl.querySelector(SELECTOR_BOX_PREVIEW_LOGO_CUSTOM);
customLogoEl.src = logoUrl;
customLogoEl.classList.remove(CLASS_HIDDEN);
this.customLogoEl.src = logoUrl;
this.customLogoEl.classList.remove(CLASS_HIDDEN);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
></path>
</svg>
</span>
<img class="bp-is-hidden bp-custom-logo" alt="logo" />
<img class="bp-is-hidden bp-custom-logo" />
<div class="bp-header-btns">
<button
class="bp-btn-plain bp-btn-annotate-draw bp-is-hidden"
Expand Down

0 comments on commit 2762678

Please sign in to comment.