Fix Guidelines page copy functionality to use consistent full path format and ensure referral ID inclusion #766
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Guidelines page copy functionality was using an inconsistent pattern compared to other pages in the application. While the existing
copyToClipboard
method already supported referral ID inclusion, the Guidelines page was calling it with just anchor IDs instead of the full path format used elsewhere.Problem
copyToClipboard('naming-conventions-table')
copyToClipboard('hello-world#hello-world')
This inconsistency meant that copied URLs from the Guidelines page would use the current page URL as the base, while other pages explicitly specified the target page path.
Solution
Updated the Guidelines page to use the consistent full path format:
copyToClipboard('naming-conventions-table')
tocopyToClipboard('guidelines#naming-conventions-table')
copyToClipboard('guidelines#@group.Key?.ToLower()')
Results
Both approaches technically work and include referral IDs when available, but the new format is more reliable:
Before:
https://site.com/guidelines#anchor?rid=referral-id
(uses current URL)After:
https://site.com/guidelines#anchor?rid=referral-id
(uses explicit path)The new approach ensures consistent behavior regardless of the current page context and matches the pattern used throughout the rest of the application.
Fixes #765.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.