Skip to content

Commit

Permalink
Fix: Allow scrollable viewers to accept keyboard input when focused
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press committed Apr 8, 2019
1 parent 2f191b8 commit 47eadd9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib/viewers/doc/DocBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class DocBaseViewer extends BaseViewer {

this.docEl = this.createViewer(document.createElement('div'));
this.docEl.classList.add('bp-doc');
this.docEl.tabIndex = '0';

if (Browser.getName() === 'Safari') {
this.docEl.classList.add(IS_SAFARI_CLASS);
Expand Down
2 changes: 0 additions & 2 deletions src/lib/viewers/image/ImageBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ class ImageBaseViewer extends BaseViewer {
// If this is a CTRL or CMD click, then ignore
if ((typeof button !== 'number' || button < 2) && !ctrlKey && !metaKey) {
this.startPanning(clientX, clientY);
event.preventDefault();
}
}

Expand All @@ -389,7 +388,6 @@ class ImageBaseViewer extends BaseViewer {
// click mouse up. In that case reset the image size, mimicking single-click-unzoom.
this.zoom('reset');
}
event.preventDefault();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/viewers/image/MultiImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class MultiImageViewer extends ImageBaseViewer {

this.wrapperEl = this.createViewer(document.createElement('div'));
this.wrapperEl.classList.add(CSS_CLASS_IMAGE_WRAPPER);
this.wrapperEl.tabIndex = '0';

this.imageEl = this.wrapperEl.appendChild(document.createElement('div'));
this.imageEl.classList.add(CSS_CLASS_IMAGE);
Expand Down
1 change: 1 addition & 0 deletions src/lib/viewers/text/PlainTextViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class PlainTextViewer extends TextBaseViewer {
this.textEl = this.createViewer(document.createElement('pre'));
this.textEl.className = 'bp-text bp-text-plain hljs';
this.textEl.classList.add(CLASS_HIDDEN);
this.textEl.tabIndex = '0';

this.codeEl = this.textEl.appendChild(document.createElement('code'));
this.codeEl.classList.add(this.options.file.extension);
Expand Down

0 comments on commit 47eadd9

Please sign in to comment.