-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
monaco.languages.register({ id: "mySpecialLanguage" });
monaco.languages.registerHoverProvider("mySpecialLanguage", {
provideHover: function (model, position) {
return xhr("./playground.html").then(function (res) {
return {
range: new monaco.Range(
1,
1,
model.getLineCount(),
model.getLineMaxColumn(model.getLineCount())
),
contents: [
{ value: "[link](https://google.com)" },
// ^ only change from the default hover example
],
};
});
},
});
monaco.editor.create(document.getElementById("container"), {
value: "\n\nHover over this text",
language: "mySpecialLanguage",
});
function xhr(url) {
var req = null;
return new Promise(function (c, e) {
req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req._canceled) {
return;
}
if (req.readyState === 4) {
if (
(req.status >= 200 && req.status < 300) ||
req.status === 1223
) {
c(req);
} else {
e(req);
}
req.onreadystatechange = function () {};
}
};
req.open("GET", url, true);
req.responseType = "";
req.send(null);
}).catch(function () {
req._canceled = true;
req.abort();
});
}Reproduction Steps
- Hover over any of the text in the preview section
- Hover over the "link" text in the opened tooltip
Actual (Problematic) Behavior
- the URL displayed in the desktop browser UI in the bottom left is always the
window.location.hrefon account of the "link" link havinghref=""(the intended URL is shown viatitleattribute) - Some native browser link interactions like "Right click to open in a new tab" are broken because the
hrefattribute isn't appropriately set to the link target (note, that the playground somehow prevents right clicking on the link, but in a real example, right clicking works) - Activating the link via click works, presumably there's some JavaScript using the value of the
data-hrefattribute which does hold the correct link target
Expected Behavior
- the URL displayed in the desktop browser UI is exactly the link target
- All native browser link interactions are available
- Activating the link via click works
Additional Context
It's not clear why this was done but it should be a straightforward fix.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels