WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#24978 closed defect (bug) (invalid)

WordPress 3.6 and jQuery tabs bug

Reported by: orange-themes.com Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: General Keywords:
Focuses: Cc:

Description

Hi!

We are wordpress themes developers and just found a bug, at least we think so!

The problem started after updating wp to 3.6.

The problem is there that now in our management panel, where we use tabs, now after option save, we got redirected to the first tab, but it should redirect to the tab in that we made some changes.

We made a blank page to test it and it also doesnt work with wp 3.6.
But if we don't use wp_enqueue_script() funtions to enqueue the scripts, but enqueue them manually like:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.js"></script>

Everything is working just fine.

Here is a small sample http://jsfiddle.net/eLx2d/19/ as you can see it works, just press on some tab, reload the page and you will get the same tab opened, but if you use wp_enqueue_script('jquery'); and wp_enqueue_script() function to enqueue other scripts it won't work.

It just ignores this part

jQuery(function() {
		jQuery( "#tabs" ).tabs({
			select: function(event, ui) {
			   window.location.replace(ui.tab.hash);
			   alert(ui.tab.hash);
			},
			cookie: {
				expires: 1
			}
		});
	});

Is that possible that it is a wp bug? Or do we miss something? Because on previous versions everything works just fine.

Thanks!

Attachments (1)

tab-test.php (9.4 KB) - added by orange-themes.com 7 years ago.
Edited file

Download all attachments as: .zip

Change History (12)

#1 @TobiasBg
7 years ago

You are loading an old and outdated version of jQuery from the jQuery CDN (1.8.1). That's something that you should never do, especially not in wp-admin.
With your manual script insertion, you are however loading a more recent version of jQuery (1.10.1).
So, most likely, the jQueryUI code in core needs the up-to-date version of jQuery (that WordPress ships with.

So, please don't load that old version from a CDN but only use the jQuery that WordPress ships with.

#2 @TobiasBg
7 years ago

  • Keywords reporter-feedback added; jquery-ui-tabs removed

Wait a minute... And you are using wp_enqueue_style() to load jQuery, where you should obviously use wp_enqueue_script().

@orange-themes.com
7 years ago

Edited file

#3 @orange-themes.com
7 years ago

Sorry there was a typo.
And a old jQuery CDN we used to test if it's something to do with the latest jQuery.
It doesn't work also with the latest jQuery

Attached the right file! As you see it also doesn't work with the latest jQuery.

Edited file

#4 @orange-themes.com
7 years ago

  • Keywords jquery-ui-tabs added; reporter-feedback removed

#5 @ocean90
7 years ago

  • Keywords reporter-feedback added; jquery-ui-tabs removed

Does it work without WordPress? Can you create a test environment on http://jsfiddle.net/ with the official libaries of the same version?

#6 @orange-themes.com
7 years ago

Made a preview http://jsfiddle.net/EAH9T/ with all official libaries, that are included in the latest wp release. And seems that it is not working.

But why? There is no error, nothing....

#7 @orange-themes.com
7 years ago

  • Keywords jquery-ui-tabs added; reporter-feedback removed

#8 @dd32
7 years ago

This isn't a WordPress specific thing, jQuery UI tabs no longer supports the 'select' event.

You have to use the 'activate' event instead, Here's a jsfiddle that shows it's usage: http://jsfiddle.net/pR8u3/3/

#9 @orange-themes.com
7 years ago

Yeah, just found it! Thanks!

#10 @orange-themes.com
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#11 @duck_
7 years ago

  • Keywords jquery-ui-tabs removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.