LearnDash Adds Presenter Mode to Focus Mode

LearnDash 4.23.0 includes a neat addition to focus mode: presenter mode. I’ve implemented similar on a handful of learning platforms that were geared towards in-person group training sessions, so this feels like a no-brainer and a relatively low-effort feature.

Enabling Presenter Mode

To enable the new feature, navigate to LearnDash LMS > Settings and find the grouping of options related to focus mode in the General tab.

The presenter mode setting can be found grouped under focus mode in LearnDash's settings

Once enabled, you’ll have the option of where the icon is placed in the focus mode UI

And it’s more interesting to watch a video or try it out yourself, but here’s what focus mode looks like with presenter mode disabled, then enabled:

Before getting into the weeds, I’d like to mention that LD has done a decent job of using best practices for accessibility here: such as using visually hidden labels for screen readers to indicate state, and creating beautiful, compliant focus states. It’s solid work, and I’m very happy to see them put a stronger emphasis on A11y lately.

Into the weeds!

A slightly problematic loading animation

In playing around with the feature today (the day of release) I’ve found that sometimes, when the scripts needed to run the feature fail to load or load slowly, it causes all focus mode content to be stuck set to opacity: 0;. I’m not really sure what the LD team were thinking adding a page load animation triggered by a “loaded” class being added to the DOM, especially given how slowly these sorts of sites load when they’re feature-heavy or stretching the limits of their server resources 😅

Here’s the offending area of presenter-mode.css, right at the end of it:


.ld-presenter-mode__body .ld-focus-header, .ld-presenter-mode__body .ld-focus-sidebar, .ld-presenter-mode__body .ld-presenter-mode {
    opacity: 0;
    transition:opacity .3s ease
}

.ld-presenter-mode__body .ld-focus-content {
    opacity: 0;
    transition:width .3s ease, opacity .3s ease
}

.ld-presenter-mode__body--loaded .ld-focus-content, .ld-presenter-mode__body--loaded .ld-focus-header, .ld-presenter-mode__body--loaded .ld-focus-sidebar, .ld-presenter-mode__body--loaded .ld-presenter-mode {
    opacity:1
}

If you’re having trouble with it, it would be pretty easy to override with a bit of CSS, but I question the wisdom of tucking this into an unrelated feature, and this method of load animation altogether (what if a user has JS disabled?!).

Decently well-written styles

The stylesheet declares a few CSS variables you could play with to customize some aspects of presenter mode positioning:

.ld-presenter-mode {
    --position-vertical: var(--ld-spacer-2);
    --position-horizontal: var(--ld-spacer-fixed-2);
    --focus-mode-header-height: 51px;
    --focus-mode-sidebar-width: 350px;
    --focus-mode-sidebar-collapsed-width: 50px;
    --focus-mode-content-top-margin: 30px;
    --focus-mode-content-z-index: 99;
}

@media (min-width: 720px) {
    .ld-presenter-mode {
        --position-vertical: var(--ld-spacer-5);
        --position-horizontal:var(--ld-spacer-fixed-5)
    }
}

These could come in pretty handy if you’ve already customized aspects of focus mode like the sidebar width in expanded or collapsed state or the header height, since you’ll only have to override these variables instead of modifying every line related to positioning in the feature’s stylesheet. You could also override --position-vertical and --position-horizontal to customize the presenter mode trigger placement relative to the edge of the screen if you don’t like where it lands.

The new floating button for triggering presenter mode doesn’t seem to respect the chosen accent color in LearnDash’s settings (yet?), so here’s a snippet to assist you in your styling adventures:

/* Mirroring LD's selectors to target all button modes for base styles */
:root .ld-presenter-mode__button, 
:root .ld-presenter-mode__button:active, 
:root .ld-presenter-mode__button:focus, 
:root .ld-presenter-mode__button:focus-within, 
:root .ld-presenter-mode__button:hover {
    background: #235af3;
    border: 2px solid #fff;
    color: #fff;
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: bold;
} 
/* Customize any of the above properties on hover, or just the background colour */
:root .ld-presenter-mode__button:hover, 
:root .ld-presenter-mode__button:focus:hover {
    background-color: #0e2a90;
}

Finally, for the true CSS nerds among you (or anyone thinking of customizing active presenter mode) here are, annotated, all of the styles applied when the ld-presenter-mode--active class is present on the ld-presenter-mode wrapper added by the feature just inside div.ld-focus-main.

/* Sets some CSS variables on ld-focus-content, removes max width to allow content to stretch to fill the screen */
.ld-presenter-mode--active + .ld-focus-content {
    --focus-mode-main-left-margin: 50px;
    --focus-mode-sidebar-open-main-left-margin: 350px;
    max-width:none !important
}

@media only screen and (min-width: 769px) {
  /* Adds left margin of -50px to the left side of ld-focus-content, to offset the space the sidebar normally takes up on non-mobile devices */
    .ld-presenter-mode--active + .ld-focus-content {
        margin:0 0 0 calc(var(--focus-mode-main-left-margin) * -1) !important
    }

  /* When the focus mode sidebar is open, -350px left margin is applied to the content on non-mobile devices */
    .ld-presenter-mode--active.ld-presenter-mode--focus-mode-sidebar-opened + .ld-focus-content {
        margin:0 0 0 calc(var(--focus-mode-sidebar-open-main-left-margin) * -1) !important
    }

  /* Overrides for the latter behaviors when the sidebar is positioned on the right side */
    .ld-presenter-mode--active.ld-presenter-mode--focus-mode-sidebar-position-right + .ld-focus-content {
        margin:0 calc(var(--focus-mode-main-left-margin) * -1) 0 0 !important
    }
    .ld-presenter-mode--active.ld-presenter-mode--focus-mode-sidebar-position-right.ld-presenter-mode--focus-mode-sidebar-opened + .ld-focus-content {
        margin:0 calc(var(--focus-mode-sidebar-open-main-left-margin) * -1) 0 0 !important
    }
}

I bet we can come up with some creative ways to mod this!

Related Content

Responses

Your email address will not be published. Required fields are marked *

Forum Rules

Be Kind & Patient

We’re here to learn and/or help each other. Please don’t be mean, rude, or condescending. Treat all members the way you should be treating dogs and your elders—with the utmost love & respect.

External Links

✅ Other websites that add value, help solve problems & contribute to the discussion. ❌ Affiliate links are prohibited. (Site owners may use affiliate links to help support the site.)

Promotion

✅ You may promote your own products/services if they are relevant to an existing discussion. You must disclose your relationship with the product(s).
❌ You may not create new posts simply to promote your products.

Non-LearnDash Topics

❌ General (free) Forum: Only LearnDash-specific topics are allowed.
✅ Premium Forums: You are allowed to post other questions tangentially related to LearnDash. Please use the appropriately named forum. If it doesn’t exist, use the “LearnDash Integrations” forum.

Our Right to Remove

We reserve the right to remove any content, at any time, for any reason. We can also merge one post with another. We will exercise caution when removing content and always try to provide an explanation.