mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-12 08:33:09 +00:00
To ensure focus and scrollTo don't conflict (when possible), I set the focus order on page show to 1) previously clicked item if revisiting that page 2) page title 3) first focusable item in the page. Fixes #1342
This commit is contained in:
parent
b4088b9422
commit
97f5a9565f
1 changed files with 10 additions and 3 deletions
|
|
@ -237,8 +237,13 @@
|
|||
|
||||
//direct focus to the page title, or otherwise first focusable element
|
||||
function reFocus( page ){
|
||||
var pageTitle = page.find( ".ui-title:eq(0)" );
|
||||
if( pageTitle.length ){
|
||||
var pageTitle = page.find( ".ui-title:eq(0)" ),
|
||||
lastClicked = page.jqmData( "lastClicked" );
|
||||
|
||||
if( lastClicked && lastClicked.length ){
|
||||
lastClicked.focus();
|
||||
}
|
||||
else if( pageTitle.length ){
|
||||
pageTitle.focus();
|
||||
}
|
||||
else{
|
||||
|
|
@ -396,7 +401,9 @@
|
|||
|
||||
if( from ){
|
||||
//set as data for returning to that spot
|
||||
from.jqmData( "lastScroll", currScroll);
|
||||
from
|
||||
.jqmData( "lastScroll", currScroll)
|
||||
.jqmData( "lastClicked", $activeClickedLink);
|
||||
//trigger before show/hide events
|
||||
from.data( "page" )._trigger( "beforehide", null, { nextPage: to } );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue