Skip to content

Commit

Permalink
use $.fn.focus instead of HTMLElement.prototype.focus
Browse files Browse the repository at this point in the history
  • Loading branch information
ramybenaroya committed Mar 7, 2016
1 parent 001dafe commit d8dcfcf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/date_picker/picker.js
Expand Up @@ -246,7 +246,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {

// Pass focus to the root element’s jQuery object.
// * Workaround for iOS8 to bring the picker’s root into view.
P.$root[0].focus()
P.$root.eq(0).focus()

// Bind the document events.
$document.on( 'click.' + STATE.id + ' focusin.' + STATE.id, function( event ) {
Expand Down Expand Up @@ -328,7 +328,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
// ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
// The focus is triggered *after* the close has completed - causing it
// to open again. So unbind and rebind the event at the next tick.
P.$root.off( 'focus.toOpen' )[0].focus()
P.$root.off( 'focus.toOpen' ).eq(0).focus()
setTimeout( function() {
P.$root.on( 'focus.toOpen', handleFocusToOpenEvent )
}, 0 )
Expand Down Expand Up @@ -614,7 +614,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
// On focus/click, focus onto the root to open it up.
on( 'focus.' + STATE.id + ' click.' + STATE.id, function( event ) {
event.preventDefault()
P.$root[0].focus()
P.$root.eq(0).focus()
}).

// Handle keyboard event based on the picker being opened or not.
Expand Down Expand Up @@ -672,7 +672,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {

// Re-focus onto the root so that users can click away
// from elements focused within the picker.
P.$root[0].focus()
P.$root.eq(0).focus()
}
}
}
Expand Down Expand Up @@ -705,7 +705,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {

// If it’s disabled or nothing inside is actively focused, re-focus the element.
if ( targetDisabled || activeElement && !$.contains( P.$root[0], activeElement ) ) {
P.$root[0].focus()
P.$root.eq(0).focus()
}

// If something is superficially changed, update the `highlight` based on the `nav`.
Expand Down

0 comments on commit d8dcfcf

Please sign in to comment.