diff --git a/code/addons/docs/template/stories/docs2/UtfSymbolScroll.mdx b/code/addons/docs/template/stories/docs2/UtfSymbolScroll.mdx new file mode 100644 index 000000000000..11c902ce3baa --- /dev/null +++ b/code/addons/docs/template/stories/docs2/UtfSymbolScroll.mdx @@ -0,0 +1,14 @@ +import { Meta } from '@storybook/addon-docs'; + + + +## Instruction + +> Instruction below works only in iframe.html. Unknown code in normal mode (with manager) removes hash from url. + +Click on [link](#anchor-with-utf-symbols-абвг). That will jump scroll to anchor after green block below. Then reload page and +it should smooth-scroll to that anchor. + +
Space for scroll test
+ +## Anchor with utf symbols (абвг) \ No newline at end of file diff --git a/code/lib/blocks/src/blocks/DocsContainer.tsx b/code/lib/blocks/src/blocks/DocsContainer.tsx index 01df02857251..3fb52a32ca53 100644 --- a/code/lib/blocks/src/blocks/DocsContainer.tsx +++ b/code/lib/blocks/src/blocks/DocsContainer.tsx @@ -41,7 +41,7 @@ export const DocsContainer: FC> = ({ try { url = new URL(globalWindow.parent.location.toString()); if (url.hash) { - const element = document.getElementById(url.hash.substring(1)); + const element = document.getElementById(decodeURIComponent(url.hash.substring(1))); if (element) { // Introducing a delay to ensure scrolling works when it's a full refresh. setTimeout(() => {