Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed element detection by checking fragment before and after decoding if necessary #141848

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/webview/browser/pre/main.js
Expand Up @@ -468,8 +468,8 @@ const handleInnerClick = (event) => {
if (node.getAttribute('href') === '#') {
event.view.scrollTo(0, 0);
} else if (node.hash && (node.getAttribute('href') === node.hash || (baseElement && node.href === baseElement.href + node.hash))) {
const fragment = node.hash.substr(1, node.hash.length - 1);
const scrollTarget = event.view.document.getElementById(decodeURIComponent(fragment));
const fragment = node.hash.slice(1);
const scrollTarget = event.view.document.getElementById(fragment) ?? event.view.document.getElementById(decodeURIComponent(fragment));
scrollTarget?.scrollIntoView();
} else {
hostMessaging.postMessage('did-click-link', node.href.baseVal || node.href);
Expand Down