Skip to content

Link to non-heading id does not go to the correct location #2771

@hamishwillee

Description

@hamishwillee
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

Add an an anchor like <strong id="myanchor">This is strong myanchor</strong> OR <span id="myanchor">This is a span with id called myanchor</span> somewhere in any text.
Then link to it using [Link to anchor](#myanchor). Given sufficient room the page will scroll further down that it should, hiding your anchor text off screen.

Note that anchors in headings work fine - but often you need to link to something that is not a heading, or which cannot have an anchor link.

What is expected?

A link to an id declared in a page should be navigated to. Here you can see the link is jumped to offscreen.

image

By comparison, if if the link is to a heading you get this

image

What is actually happening?

As above

Other relevant information

Further, while a heading with an id in the body will link correctly, if the heading is defined inside anotehr element like a table, then the linking no longer works properly - ie it is just like an id in a span.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions