Toolbar: Prevent adminbar from hiding in-page anchors.

Use scroll-padding-top to offset scroll position on in-page anchors when adminbar is active. Also adjusts existing scroll padding for core themes that implement it.

Props afercia, kingkero, audrasjb, dufresnesteven, thimalw, sabernhardt, costdev.
Fixes #46371.

Built from https://develop.svn.wordpress.org/trunk@52198


git-svn-id: http://core.svn.wordpress.org/trunk@51790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2021-11-17 17:20:00 +00:00
parent 1589bba4f5
commit bba44bf5e5
9 changed files with 13 additions and 39 deletions

View File

@ -166,10 +166,6 @@ td {
padding-left: 7px;
}
.entry-content p span[id^="more-"] {
float: right;
}
/**
* 6.5 Galleries

View File

@ -95,6 +95,7 @@ html {
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
scroll-padding-top: calc( var(--wp-admin--admin-bar--height, 0px) + 48px );
}
body,
@ -1304,10 +1305,6 @@ a.post-thumbnail:hover {
padding: 12px 10px 0;
}
.site-content .entry-content {
padding-top: 22px;
}
.page .entry-content {
padding-top: 0;
}
@ -1392,34 +1389,6 @@ a.post-thumbnail:hover {
white-space: nowrap;
}
.entry-content span[id^="more-"] {
display: block;
padding-top: 52px;
margin-top: -76px;
}
.admin-bar .entry-content span[id^="more-"] {
padding-top: 84px;
margin-top: -108px;
}
.entry-content span[id^="more-"] + blockquote,
.entry-content span[id^="more-"] + div,
.entry-content span[id^="more-"] + figure,
.entry-content span[id^="more-"] + hr,
.entry-content span[id^="more-"] + ol,
.entry-content span[id^="more-"] + ul,
.entry-content span[id^="more-"] + p,
.entry-content span[id^="more-"] + pre {
margin-top: 24px;
}
.entry-content p span[id^="more-"] {
width: 1px;
height: 24px;
float: left;
}
/* Mediaelements */
.hentry .mejs-container,

View File

@ -3382,6 +3382,9 @@ p > object:only-child {
}
@media screen and (min-width: 48em) {
html {
scroll-padding-top: calc( var(--wp-admin--admin-bar--height, 0px) + 72px );
}
/* Typography */

View File

@ -2774,6 +2774,10 @@ p > video {
*/
@media screen and (min-width: 44.375em) {
html {
scroll-padding-top: calc( var(--wp-admin--admin-bar--height, 0px) + 21px );
}
body:not(.custom-background-image):before,
body:not(.custom-background-image):after {
background: inherit;

View File

@ -1,6 +1,7 @@
/*! This file is auto-generated */
html {
--wp-admin--admin-bar--height: 32px;
scroll-padding-top: var(--wp-admin--admin-bar--height);
}
#wpadminbar * {

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
html {
--wp-admin--admin-bar--height: 32px;
scroll-padding-top: var(--wp-admin--admin-bar--height);
}
#wpadminbar * {

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52197';
$wp_version = '5.9-alpha-52198';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.