microsoft / CopilotStudioSamples

MIT License
333 stars 269 forks source link

Handle SharePoint Links in SharePoint SSO Component #242

Open lifan0127 opened 2 months ago

lifan0127 commented 2 months ago

When the SharePoint SSO Component handles click on a SharePoint internal link, the target="_blank tag is not honored and the link will open in the same window, disrupting the current conversation. The following blog article provides more explanation:

https://julieturner.net/post/spfx-anchor-tags/

Posted on August 8, 2018 | 2 minutes | 418 words | Julie Turner If you’re developing SharePoint Framework web parts you may have run across an issue whereby your anchor tags will not honor the target=”_blank” attribute allowing you to open a url in a new browser tab. The issue manifests itself only when your goal is to open another SharePoint page from a SharePoint page, i.e. the href is in the SharePoint domain. The reason for this is SharePoint’s built in but rather complex Page Router. Basically, the Page Router is the mechanism by which pages are rendered in SharePoint. In the most basic terms a component sits between you and a page refresh providing logic to how much and when parts of the page need to be loaded. What that means for you is that when you are trying to load a SharePoint page the router steps in and “decides” how it will be rendered and because of this the target attribute is ignored.

adilei commented 2 months ago

Thanks! Hopefully will have time to add this