Skip to content

Scroll webview to top if unmatched fragment is #top#164070

Merged
mjbvz merged 1 commit into
microsoft:mainfrom
dsanders11:webview-top-fragment
Oct 20, 2022
Merged

Scroll webview to top if unmatched fragment is #top#164070
mjbvz merged 1 commit into
microsoft:mainfrom
dsanders11:webview-top-fragment

Conversation

@dsanders11

Copy link
Copy Markdown
Member

In the HTML Standard, section 7.11.9 “Navigating to a fragment” states that when looking for the indicated part of the document, if the fragment doesn’t match any element, but is the special value “top”, then the top of the document is indicated:

If decodedFragment is an ASCII case-insensitive match for the string top, then the indicated part of the document is the top of the document; return.

This PR updates the logic for webviews to follow the spec. Can be tested by putting a link to #top in a Markdown document and previewing the document.

cc @mjbvz

Comment thread src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html Outdated
@dsanders11
dsanders11 force-pushed the webview-top-fragment branch from 2d556e7 to 1c75fd9 Compare October 19, 2022 23:59
@dsanders11
dsanders11 requested a review from mjbvz October 19, 2022 23:59
@mjbvz
mjbvz merged commit f7a080d into microsoft:main Oct 20, 2022
@mjbvz

mjbvz commented Oct 20, 2022

Copy link
Copy Markdown
Contributor

Thanks!

@mjbvz mjbvz added this to the October 2022 milestone Oct 20, 2022
@dsanders11
dsanders11 deleted the webview-top-fragment branch October 20, 2022 18:44
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants