Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ten-snakes-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'polaris.shopify.com': patch
---

Updated copy url to change browser url
13 changes: 11 additions & 2 deletions polaris.shopify.com/src/components/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ function HeadingWithCopyButton({
? window.location.origin
: 'https://polaris.shopify.com';
const path = typeof window !== 'undefined' ? window.location.pathname : '';
const [copy, didJustCopy] = useCopyToClipboard(`${origin}${path}#${id}`);
const url = `${origin}${path}#${id}`;
const [copy, didJustCopy] = useCopyToClipboard(url);

return (
<Element id={id} className={styles.MarkdownHeading}>
Expand All @@ -164,7 +165,15 @@ function HeadingWithCopyButton({
ariaLabel="Copy to clipboard"
renderContent={() => <p>{didJustCopy ? 'Copied' : 'Copy'}</p>}
>
<button className={styles.MarkdownCopyButton} onClick={copy}>
<button
className={styles.MarkdownCopyButton}
onClick={() => {
copy();
if (typeof window !== 'undefined') {
window.history.pushState(id, '', url);
}
}}
>
<Icon source={ClipboardMinor} width={16} height={16} />
</button>
</Tooltip>
Expand Down