Only try to scroll to element when the target path exactly matches the base path of the current page
Fixes #121045 For pages that set `<base>`, if the target of link click goes to different path than the current page (taken from `base`), treat it as a normal link open instead
This commit is contained in:
parent
0a6309be1e
commit
be2026c324
1 changed files with 2 additions and 2 deletions
|
@ -324,8 +324,8 @@ export async function createWebviewManager(host) {
|
|||
if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
|
||||
if (node.getAttribute('href') === '#') {
|
||||
event.view.scrollTo(0, 0);
|
||||
} else if (node.hash && (node.getAttribute('href') === node.hash || (baseElement && node.href.indexOf(baseElement.href) >= 0))) {
|
||||
let scrollTarget = event.view.document.getElementById(node.hash.substr(1, node.hash.length - 1));
|
||||
} else if (node.hash && (node.getAttribute('href') === node.hash || (baseElement && node.href === baseElement.href + node.hash))) {
|
||||
const scrollTarget = event.view.document.getElementById(node.hash.substr(1, node.hash.length - 1));
|
||||
if (scrollTarget) {
|
||||
scrollTarget.scrollIntoView();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue