Skip to content

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

Merged
Matt Bierner (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
Matt Bierner (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 Matt Bierner (@mjbvz)

Comment thread src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html Outdated
@mjbvz
Matt Bierner (mjbvz) merged commit f7a080d into microsoft:main Oct 20, 2022
@mjbvz

Copy link
Copy Markdown
Contributor

Thanks!

@mjbvz Matt Bierner (mjbvz) added this to the October 2022 milestone Oct 20, 2022
@dsanders11
David Sanders (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