Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-117

An in-page anchor scrolls the page to its target at the reading line

When the reader follows an anchor, the extension SHALL post navigateAnchor with the anchor value and, when the shown document has a matching fragment, its start and end source lines, so that the page scrolls the mapped block of the source line, else the element whose id equals the decoded value or the value without a leading ^, to the reading line below the band, and does not scroll when no block or element is found or the request names another render.

Step 1 of path 2 in StRS-MDOKFSTUDIO-TOOLBAR-011: from “A link comes into view” to “The heading of the anchor is at the reading line”.

Scenarios 4

The situations the tests check; open one to read it.

nominalHeading anchor
Givenan anchor #target on a heading at line 5
Whenit is followed
ThennavigateAnchor carries the value, sourceLine 5 and sourceEndLine 5, and the page scrolls so the block is at the reading line
nominalUnknown fragment
Givenan anchor #generated-id with no source line
Whenit is followed
ThennavigateAnchor carries the value only
boundaryWhere the page scrolls to
navigateAnchor receivedOutcome
a source line that a mapped block holdsthe page scrolls so the block is at the reading line
#^note with no source line, and an element with id notethe page scrolls to that element
a value that cannot be decoded, with a source line that maps to a blockthe page scrolls to that block (the source line wins)
refusalInvalid, unknown and stale requests
navigateAnchor receivedOutcome
an unknown idthe page does not scroll
a malformed escapethe page does not scroll
an escape still left after four decoding rounds, such as %41the page does not scroll, whatever its digits
a stale request id (another render)the page does not scroll

Implemented in 2

Tested by 3