From 7e10dd7fdac5e53896ddf0f25f1225909fcdbc68 Mon Sep 17 00:00:00 2001 From: Mikhail Shipov Date: Wed, 7 Aug 2024 12:12:22 +0300 Subject: [PATCH 1/2] Fix docs scroll for non-ascii anchors --- code/lib/blocks/src/blocks/DocsContainer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/blocks/src/blocks/DocsContainer.tsx b/code/lib/blocks/src/blocks/DocsContainer.tsx index e5ad466f7f6a..a18f0cc4ad06 100644 --- a/code/lib/blocks/src/blocks/DocsContainer.tsx +++ b/code/lib/blocks/src/blocks/DocsContainer.tsx @@ -38,7 +38,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(() => { From d20b3c6cfa86246bf09945af9b9d9c6305a3d309 Mon Sep 17 00:00:00 2001 From: Mikhail Shipov Date: Fri, 16 Aug 2024 23:58:33 +0300 Subject: [PATCH 2/2] add test story --- .../template/stories/docs2/UtfSymbolScroll.mdx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 code/addons/docs/template/stories/docs2/UtfSymbolScroll.mdx 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