Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-085

A link shows its target kind in a tooltip without changing its target

When the page receives previewLinkTargets, the extension SHALL set on every link with a matching request the attribute data-sphinx-preview-link-state to the kind and the title to the path, else the reason, else the request, follow a link to a blocked target with a warning icon that carries the reason, and keep the original navigation request and the look of the link unchanged.

Step 2 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-011: from “The target of the link is known” to “The tooltip names where the link leads”.

Scenarios 4

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

nominalKind and tooltip
GivenOutcome
a local target with a paththe link has state local and the path as its title
a blocked target with a reasonthe link has state blocked and the reason as its title
a target with neither path nor reasonthe link has the request as its title
two links with the same requestboth are marked
boundaryThe hint never replaces the target
GivenWhenThen
a link with request ../x.md and a hint with another paththe hint is applied, then the link is clickedthe navigation request is still ../x.md and the click posts it
a link with a blocked hintthe link is clickedthe original request is posted and the host shows the refusal
boundaryA missing or blocked target keeps its link and gains a warning icon
Givena link to a missing file whose hint is blocked with the reason "File not found: docs/guid.md", and a link to an existing file
Whenthe links are rendered
Thenthe first has the state attribute blocked, its text and colour are those of the valid link (no stylesheet rule matches the state attribute), and a small warning icon follows it with the reason as its tooltip
the icon is hidden from assistive technology while the link carries the reason as its description (aria-describedby naming the icon, whose accessible label is the reason)
the existing file gets no icon, and a later hint that makes the target valid removes the icon and the description
ReasonSource
File not found: {path of the link}the file does not exist or cannot be read
the refusal textany other blocked target (outside the workspace, not a regular file, scheme not allowed)
nominalHints survive an in-place content update
GivenWhenThen
a link with a hint and a content update that keeps the linkthe update is appliedthe new link element has the same state and title again, without a new request
a content update that adds a linkthe update is appliedthe new link is observed and looked up when it comes into view

Implemented in 1

Tested by 4