Anchor Bug

  • Unknown's avatar

    I just made an anchor and it turned the text black-it’s supposed to be white because it’s a black background-and when clicked it scrolls farther down than it should be. Any way to fix this on my end or WordPress’s end?

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    Can you point me to where on your site the anchor changed color? I see you have a table of contents on the front page with anchor links, but everything on that page is black text on white, so I’m not seeing what you described.

    As for the anchor heading being hidden after the jump, that’s a known issue. The page is actually jumping to where it should, with the anchor element at the very top of the browser window. But if you’re logged into a WordPress site, that space is already occupied by the admin bar, so the element is positioned behind it.

    This was fixed in WordPress 5.9, but I see it’s still happening here on WordPress.com, so there’s likely something extra we’ll need to do on our end to apply that fix on WordPress.com.

    I’ve opened a new bug report so our developers can look into this, but I’m not able to tell you when this might be fixed.

    If you wanted to try something on your end in the meantime, I was able to figure out a workaround:

    Just above each heading, insert a Spacer block. Set the block’s height to 1px, so it doesn’t otherwise mess up the layout of your page, and add your anchor ID to that block instead of to the heading.

    Now when you click on an anchor link, the spacer block will be at the top, behind the admin bar, with the heading appearing just below the admin bar.

  • Unknown's avatar

    Hi kokkeih,

    Originally the table of contents had a black background to differentiate it from the actual content but I had to change it to a white background because whenever I added an anchor link to the text it made the text black- meaning it wouldn’t show up on the black background. I tried changing it back to white but it wouldn’t change, so while waiting for a response I just changed the background to white.

  • Thanks for the extra detail.

    I’m able to replicate what you’re seeing. This feels like a bug to me – I’d expect it to be possible to change link colors via the “Highlight” option in the block toolbar – so I’ve reported it to our developers as well.

    But in your case there’s a way around it. As you want to change the color for all links in that block, click on your List block, then set a link color via the color controls in the sidebar. Here’s a short video showing how:

    https://d.pr/i/avcmFJ

  • Hi there,

    I just wanted to let you know that the page-jump issue should be fixed now.

    I don’t have an update for the link color issue yet – it looks like that might be related to an issue in the open source version of WordPress itself, which means it might need to be fixed over on WordPress.org instead. But our team is still looking into this.

  • The topic ‘Anchor Bug’ is closed to new replies.