SOLVED

URL query string to expand collapsed section on page?

%3CLINGO-SUB%20id%3D%22lingo-sub-3065771%22%20slang%3D%22en-US%22%3EURL%20query%20string%20to%20expand%20collapsed%20section%20on%20page%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3065771%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20been%20using%20collapsible%20sections%20(a%20LOT)%20lately%20to%20create%20FAQ%20type%20pages%20in%20SharePoint.%20It%20makes%20for%20a%20very%20intuitive%20interface%20for%20viewers%20in%20the%20site.%20Sometimes%2C%20though%2C%20we%20want%20to%20point%20someone%20to%20a%20particular%20question.%20Since%20each%20section's%20%22title%22%20is%20a%20heading%20(h2)%2C%20it's%20easy%20to%20hover%20over%20it%2C%20right-click%20the%20chain%20link%20icon%20and%20select%20%22copy%20link%22.%20The%20issue%2C%20though%2C%20is%20that%20if%20the%20section%20is%20configured%20to%20be%20collapsed%20by%20default%2C%20when%20someone%20uses%20that%20link%2C%20it's%20still%20collapsed.%20Yes%2C%20they%20just%20need%20to%20click%20the%20caret%20icon%20to%20expand%20it%2C%20but%20it'd%20be%20better%20if%20there%20were%20a%20way%20to%20modify%20the%20link%20to%20expand%20that%20section.%20For%20example%2C%20adding%20a%20query%20string%20parameter%20(e.g.%3A%20%3FsectionMode%3Dexpanded).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20poking%20at%20it%20using%20Edge's%20developer%20tools%2C%20trying%20to%20identify%20what%20exactly%20happens%20when%20that%20expand%2Fcollapse%20icon%20is%20clicked%2C%20but%20had%20no%20luck.%20Anyone%20else%20have%20any%20idea%20how%20this%20might%20be%20accomplished%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3065771%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESites%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3069984%22%20slang%3D%22en-US%22%3ERe%3A%20URL%20query%20string%20to%20expand%20collapsed%20section%20on%20page%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3069984%22%20slang%3D%22en-US%22%3EI%20need%20this%20too.%20Thanks%20Chad.%3C%2FLINGO-BODY%3E
Regular Contributor

I've been using collapsible sections (a LOT) lately to create FAQ type pages in SharePoint. It makes for a very intuitive interface for viewers in the site. Sometimes, though, we want to point someone to a particular question. Since each section's "title" is a heading (h2), it's easy to hover over it, right-click the chain link icon and select "copy link". The issue, though, is that if the section is configured to be collapsed by default, when someone uses that link, it's still collapsed. Yes, they just need to click the caret icon to expand it, but it'd be better if there were a way to modify the link to expand that section. For example, adding a query string parameter (e.g.: ?sectionMode=expanded). 

 

I've been poking at it using Edge's developer tools, trying to identify what exactly happens when that expand/collapse icon is clicked, but had no luck. Anyone else have any idea how this might be accomplished?

10 Replies
I need this too. Thanks Chad.
@Chad_V_Kealey : Thanks to @simigu who linked our questions. I need this feature, too. But as there are two streams now. I marked simigu's response on my thread as a soltion and consider this thread as leading part of the discussion.
Hopefully there will be a solution soon.

fyi: Sadly @ganeshsanap didn't find a solution for this problem, too.

https://techcommunity.microsoft.com/t5/sharepoint/sharepoint-online-collapsible-sections-on-modern-p...

 

(See end of discussion)

best response confirmed by Chad_V_Kealey (Regular Contributor)
Solution
Add a Text with header format in the section. Sharepoint will give this header a page anchor automatically. Link to this page anchor via URL. The section will now be expanded.
@StevenNeele
Thank you. Yes, this works. Tried this out with a 'Heading 2' formatted text, works as described. Visiting the URL brings you straight to the text, with the section being expanded. So, this is the solution.
Works for me too! Thanks!
That's A solution, but may not be ideal in some cases. For example, if you're using collapsing sections to create an FAQ page. One of the questions is "How do I change my password?", so you create a collapsible section with that title (so it's visible when the section is collapsed. The method you're suggesting would require duplicating the question (or at least adding a heading) inside that section. Sure, you could make it something like "Answer:" so you're not duplicating the question, but that would still look a bit off.

Ideally, since every collapsible section has a heading-formatted title, there would be an option/setting along the lines of "Expand section on focus".

@Chad_V_Kealey Indeed, this is a workaround and not the best solution. But for now in some cases it can do the trick!

You're definitivly right. The solution is only a work around. For my case it is sufficient. (I'm lucky: Each of my Sections already had a structure with four given headlines).
If I now link to the first headline in the section I have the problem that the title is cut off (because the headline is top of the page).
-->So it is still the best solution - but hopefully in one of the next releases there will be something built in (including a feature that expanded section will be automatically collapsed if you use another link to switch the "questions" on the page....