Merge pull request #577 from msalsbery/viewer_focus

Removed Viewer focusHandler, added tabIndex option
This commit is contained in:
Ian Gilman 2015-01-21 15:30:38 -08:00
commit db88fe4166
4 changed files with 8 additions and 9 deletions

View File

@ -24,6 +24,8 @@ OPENSEADRAGON CHANGELOG
* Fixed pointer event model detection for IE 10 and IE 11 (#571)
* Added setMouseNavEnabled() support to Navigator (#572)
* MouseTracker now defaults to tracking on (#558)
* Removed Viewer focusHandler/onCanvasFocus (#577)
* Added tabIndex option to viewer (#577)
1.2.0:

View File

@ -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,

View File

@ -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,

View File

@ -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";
@ -302,7 +302,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 ),
@ -2190,13 +2189,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 ){