Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Global way to force auto-expand dropdowns in Frameless

Contributor ,
Mar 19, 2024 Mar 19, 2024

version - RH 2022.3.93

Output preset - Frameless

---

For some reason, a few writers want the dropdowns to auto-expand upon loading the page.

 

I can achieve this for an individual dropdown with the attribute data-expanded="true".

WoutJacobs_0-1710851569036.pngWoutJacobs_1-1710851622032.png

WoutJacobs_2-1710851705215.png

***

Before I loop through all dropdowns in my project, I'd like to ask if I'm not overcomplicating things and if there is a simpler way of doing this?

TOPICS
New UI
343
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 19, 2024 Mar 19, 2024

If you can find the code that makes that button work in the skin you're using, you should be able to bung it in a script so you don't have to write your own code.

 

For example, I tried this in the master page of a RH2019 Frameless project. You can probably also add it in the User Assets section of the skin as an attached JS file. Note I'm just a hack and can't advise on best practices. 

 

Note: you'll need to check the code for RH2022 as I'm sure it's changed in newer versions.

 

Also test thor

...
Translate
Community Expert ,
Mar 19, 2024 Mar 19, 2024

I don't recall any control in the Preset for being able to do this [set them all to auto-expand], so your approach is probably fine. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2024 Mar 19, 2024

It's not what you want but the icon below allows your users to expand/contract all.

 

image.png

 

In Author mode when editing, click within one dropdown and the context menu has expand/contract all options.

________________________________________________________

My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

 

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2024 Mar 19, 2024

If you can find the code that makes that button work in the skin you're using, you should be able to bung it in a script so you don't have to write your own code.

 

For example, I tried this in the master page of a RH2019 Frameless project. You can probably also add it in the User Assets section of the skin as an attached JS file. Note I'm just a hack and can't advise on best practices. 

 

Note: you'll need to check the code for RH2022 as I'm sure it's changed in newer versions.

 

Also test thoroughly as I couldn't say what side effects might result. Probably consult a friendly developer if you have one. 🙂

 

  document.addEventListener("DOMContentLoaded", (event) => {
    rh.model.publish(rh.consts('EVT_EXPAND_COLLAPSE_ALL'));
  });

(The first and third lines make sure the html has all been loaded before the script runs - I think it's necessary but you could try without them if you want. The second line is the button code I found in my skin under Topic Page Buttons > Expand/Collapse All > OnClick)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2024 Mar 19, 2024
LATEST

I'm also assuming you want this in your output, rather than in the RH editor. I think Peter's manual suggestion would be the only option in the editor.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp