mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #537 from bitjutsu/bug-500-keyboard-nav
fix #500 - requests keyboard focus when canvas is clicked
This commit is contained in:
commit
1765e3c0c9
@ -300,6 +300,8 @@ $.Viewer = function( options ) {
|
||||
style.left = "0px";
|
||||
style.resize = "none";
|
||||
}( this.keyboardCommandArea.style ));
|
||||
// Set read-only - hides keyboard on mobile devices, still allows input.
|
||||
this.keyboardCommandArea.readOnly = true;
|
||||
|
||||
this.container.insertBefore( this.canvas, this.container.firstChild );
|
||||
this.container.insertBefore( this.keyboardCommandArea, this.container.firstChild );
|
||||
@ -2310,6 +2312,13 @@ function onBlur(){
|
||||
function onCanvasClick( event ) {
|
||||
var gestureSettings;
|
||||
|
||||
var haveKeyboardFocus = document.activeElement == this.keyboardCommandArea;
|
||||
|
||||
// If we don't have keyboard focus, request it.
|
||||
if ( !haveKeyboardFocus ) {
|
||||
this.keyboardCommandArea.focus();
|
||||
}
|
||||
|
||||
if ( !event.preventDefaultAction && this.viewport && event.quick ) {
|
||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||
if ( gestureSettings.clickToZoom ) {
|
||||
|
Loading…
Reference in New Issue
Block a user