From 1e8b3a1ea6ebd5c49213610a511319f361736e71 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 21 Jan 2015 11:49:19 -0800 Subject: [PATCH 1/4] Removed Viewer focusHandler/onCanvasFocus Presumably, this was meant to manually scroll the viewer into view when it receives focus. This is already handled by browsers when tabbing to the viewer, so doing it explicitly isn't necessary, and it creates a negative user experience when clicking on a viewer to give it focus (as of #569). --- src/viewer.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 04587719..4ba9ab48 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -301,7 +301,6 @@ $.Viewer = function( options ) { clickDistThreshold: this.clickDistThreshold, dblClickTimeThreshold: this.dblClickTimeThreshold, dblClickDistThreshold: this.dblClickDistThreshold, - focusHandler: $.delegate( this, onCanvasFocus ), keyDownHandler: $.delegate( this, onCanvasKeyDown ), keyHandler: $.delegate( this, onCanvasKeyPress ), clickHandler: $.delegate( this, onCanvasClick ), @@ -2188,13 +2187,6 @@ function onBlur(){ } -function onCanvasFocus( event ) { - if ( !event.preventDefaultAction ) { - var point = $.getElementPosition( this.element ); - window.scrollTo( 0, point.y ); - } -} - function onCanvasKeyDown( event ) { if ( !event.preventDefaultAction && !event.ctrl && !event.alt && !event.meta ) { switch( event.keyCode ){ From b639f1e168a1629f8bcfcc0a9ece2d728861c285 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 21 Jan 2015 11:51:56 -0800 Subject: [PATCH 2/4] changelog update --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 1cd6f9df..7a747759 100644 --- a/changelog.txt +++ b/changelog.txt @@ -23,6 +23,7 @@ OPENSEADRAGON CHANGELOG * Removed 'position' property from MouseTracker keyDownHandler/keyUpHandler/keyHandler functions (#573) * Fixed pointer event model detection for IE 10 and IE 11 (#571) * Added setMouseNavEnabled() support to Navigator (#572) +* Removed Viewer focusHandler/onCanvasFocus (#577) 1.2.0: From 43d892451339f65a74b12d98301d0132f6579de0 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 21 Jan 2015 12:47:42 -0800 Subject: [PATCH 3/4] Added tabIndex option to viewer --- src/navigator.js | 1 + src/openseadragon.js | 4 ++++ src/viewer.js | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/navigator.js b/src/navigator.js index fb0756e8..dcea7687 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -98,6 +98,7 @@ $.Navigator = function( options ){ sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio }, options, { element: this.element, + tabIndex: -1, // No keyboard navigation, omit from tab order //These need to be overridden to prevent recursion since //the navigator is a viewer and a viewer has a navigator showNavigator: false, diff --git a/src/openseadragon.js b/src/openseadragon.js index 27d3262c..f56f10da 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -126,6 +126,10 @@ * The element to append the viewer's container element to. If not provided, the 'id' property must be provided. * If both the element and id properties are specified, the viewer is appended to the element provided in the element property. * + * @property {Number} [tabIndex=0] + * Tabbing order index to assign to the viewer element. Positive values are selected in increasing order. When tabIndex is 0 + * source order is used. A negative value omits the viewer from the tabbing order. + * * @property {Array|String|Function|Object[]|Array[]|String[]|Function[]} [tileSources=null] * As an Array, the tileSource can hold either Objects or mixed * types of Arrays of Objects, Strings, or Functions. When a value is a String, diff --git a/src/viewer.js b/src/viewer.js index 4ba9ab48..4cf7fad7 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -268,7 +268,7 @@ $.Viewer = function( options ) { style.left = "0px"; }(this.canvas.style)); $.setElementTouchActionNone( this.canvas ); - this.canvas.tabIndex = 0; + this.canvas.tabIndex = options.tabIndex || 0; //the container is created through applying the ControlDock constructor above this.container.className = "openseadragon-container"; From a09b6837d3d9e1032bc6b3a8d4fd2e73c48788ee Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 21 Jan 2015 12:49:45 -0800 Subject: [PATCH 4/4] changelog update --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 7a747759..6ab20b94 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ OPENSEADRAGON CHANGELOG * Fixed pointer event model detection for IE 10 and IE 11 (#571) * Added setMouseNavEnabled() support to Navigator (#572) * Removed Viewer focusHandler/onCanvasFocus (#577) +* Added tabIndex option to viewer (#577) 1.2.0: