"Toggle Preview" button isn't a toggle

Created on 4 April 2023, over 1 year ago
Updated 6 April 2023, over 1 year ago

Problem/Motivation

Labelling the button "Toggle Preview" implies that clicking it a second time will dismiss the preview pane. In my testing, it did not.

Steps to reproduce

Install this module on a fresh install of Drupal. Go to create an article. Click the "Toggle Preview" button. Click it a second time and see that the pane refreshes instead of going away.

Proposed resolution

Update the samePagePreviewTriggerPreview Javascript function to check if the preview pane is open, and if so, click the close preview button instead.

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇨🇦Canada mandclu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mandclu
  • 🇺🇸United States cosmicdreams Minneapolis/St. Paul

    That's a good point.

    I'm retargeting this issue to version 2 where we are endeavoring to replace the button with a checkbox that will actually provide a "toggle" behavior.

  • 🇨🇦Canada mandclu

    I see that the work so far in 📌 On by default, make off-by-default an opt-in setting Closed: duplicate seems to be visually hiding the "Toggle Preview" link, which seems to imply that there may be value in keeping it available for assistive devices, in addition to its use as a hidden trigger for launching the settings tray.

    Still, the link does not currently act as a toggle, though the checkbox will. I would suggest that for the sake of this issue, the link and the checkbox should switch their labels, since the checkbox will act as a toggle, whereas the link will only open the preview pane.

  • Assigned to shivam_tiwari
  • Issue was unassigned.
  • Status changed to Closed: duplicate over 1 year ago
  • 🇺🇸United States cosmicdreams Minneapolis/St. Paul

    I understand the ask here to be:

    Change the name of the button to something like "Open Preview" and maybe hide the button from screenreaders.

  • 🇨🇦Canada mandclu

    Added a commit to Checkbox with localStorage, trigger existing elements Fixed with my suggested labels. My comment about screen readers was because the existing code I had seen added the "visually-hidden" class to the link to launch the preview pane, so I assumed this was deliberately done to make it available to screen readers. If it doesn't need to be available to them, using the "hidden" class instead would suffice.

Production build 0.71.5 2024