date popup works fine If I reach to that particular textfield & click on that but when i reach there via 'Tabs' [using keyboard only] it won't popup as it is being focused only when click event is triggered in date_popup.js while simply registering focus() with popup class will do the job as focus will work in both cases whether it is keyboard or click event via mouse.

Replacing this [ in date_popup.js ]

 $(this).click(function() {
              $(this).focus();
            });

With this

$(this).focus();

Attached is the patch which does the work.

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, date_popup_focus.patch, failed testing.

JohnAlbin’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
Status: Needs work » Needs review

The patch applies to 6.x-2.x-dev, not to 6.x-2.8 directly.

JohnAlbin’s picture

date_popup_focus.patch queued for re-testing.

ohthehugemanatee’s picture

FileSize
458 bytes

Had the same issue on 7.x, so I rerolled the patch for 7.x .

Jelle_S’s picture

Not sure if related, but if you start in a field above the date popup field and tab to the date popup field, the first time the popup will not trigger, as mentioned in the issue. But another issue is that when you tab again to go to the next field (time field next to the date popup field in my case), the focus is put somewhere else entirely (toolbar in my case). If you then click in your first field again and tab towards the date popup field, when you reach the date popup field, the popup will show. Tab again and you will reach the time field as you would have expected the first time through. From then on everything works as it should. It just doesn't seem to work the first time round.

PS: This was on 7.x

asirjacques’s picture

I had the same issue but I solved it with this little trick into my Javascript file:

$('#myfield').find('.form-text').trigger('focus');
$('#myfield').find('.form-text').trigger('blur');

Cheers.

asirjacques’s picture

Issue summary: View changes

adding filename

jgullstr’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Issue summary: View changes
FileSize
1.17 KB

This is not resolved in 7.x-2.x.

Problem

First-time tabbing to a datepicker field does not open the calendar.
First-time tabbing to a timeEntry field prevents the user from tabbing further.

Reproduction

Create a date popup field, navigate to the field using TAB.

Reason

Drupal.behaviors.date_popup tries to lazy-load the datepicker instances. Instead of triggering a focus event when the plug-in is loaded, makeFocusHandler binds to the click event. The click event will fire after focus when if the field is clicked the first time, but if tabbed to, the plugin wont run before tabbed to a second time.

Solution

Either remove the lazy-loading entirely (initialize date pickers in the behavior), or trigger a focus event after initializing the plugin on the field (same approach as in earlier posts). Patch for triggering focus attached.

(Also, unbinding makeFocusHandler after its first call should be more effective than checking for the date-popup-init class on subsequent focus events.)

christine1126’s picture

@Jelle_S (#5) I had similar issue with tabbing order on date/time. Go to 'Date popup' under configuration > Change Timepicker from 'Use default jQuery timepicker' to 'Manual time entry, no jQuery timepicker'. Then tab order works ok.

cydharttha’s picture

Patch from #7 works great so far here. Thanks!

djdevin’s picture

Confirmed this is still happening.

Re-rolled for 7.x-2.x

steinmb’s picture

Status: Needs review » Reviewed & tested by the community

Confirm the patch addresses the issue. Normal tabbing forward and backwards now works.

Checking patch date_popup/date_popup.js...
Hunk #1 succeeded at 12 (offset 2 lines).
Hunk #2 succeeded at 27 (offset 2 lines).
Hunk #3 succeeded at 52 (offset 2 lines).
Applied patch date_popup/date_popup.js cleanly.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed
Parent issue: » #2867810: Plan for Date 7.x-2.11 release

Committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.