WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22520 closed defect (bug) (fixed)

Toolbar JS with jQuery doesn't match non-jQuery behavior with hashes (e.g. read more link)

Reported by: helenyhou Owned by: azaozz
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.3
Component: Toolbar Keywords: has-patch
Focuses: Cc:

Description

In /wp-includes/js/admin-bar.js, we have a block that uses jQuery if available and then falls back to another block of plain JS if not. The JS version does the following to help prevent the toolbar from covering up content when a hash is present in the URL (w = window):

if ( w.location.hash )
	w.scrollBy(0,-32);

The jQuery version does not seem to do the same, but it should. Patch is forthcoming.

Attachments (2)

patch-more-toolbar-offset.diff (307 bytes) - added by tlovett1 3 years ago.
Patches problem in wp-includes/js/admin-bar.js
patch-more-toolbar-offset-v1.diff (465 bytes) - added by tlovett1 3 years ago.
This version has the if statement within the jquery exists if

Download all attachments as: .zip

Change History (6)

@tlovett13 years ago

Patches problem in wp-includes/js/admin-bar.js

@tlovett13 years ago

This version has the if statement within the jquery exists if

comment:2 @helenyhou3 years ago

patch-more-toolbar-offset-v1.diff works for me. patch-more-toolbar-offset.diff appears more ideal on first glance (moving it out of the if/else block since it's used in both places) but doesn't actually work, I suppose because it no longer waits until load.

comment:3 @azaozz3 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 22728:

Toolbar: sync jQuery and non-jQuery JS behaviour when there's a hash in the url, props tlovett1, fixes #22520

comment:4 @helenyhou3 years ago

  • Milestone changed from Awaiting Review to 3.5
Note: See TracTickets for help on using tickets.