Problem/Motivation

The Canvas backend editor (/canvas/editor/…) uses the site default (front-end) theme. This module enables async remaining CSS whenever the active theme is in enabled_themes / the theme’s info.yml. The only extra skip is media.oembed_iframe. There is no equivalent of SDC Critical CSS’s editorial skip (_admin_route, _hide_admin_toolbar, iframe).

Result: Canvas editor UI CSS is loaded as preload-as-style. Styles break on the edit screen. The same sites are fine with SDC Critical CSS alone on public Canvas pages.

Mercury Editor preview iframes can hit the same path (front-end theme + async CSS). Companion issue on SDC Critical CSS covers inlining/aggregate stripping there.

Steps to reproduce

  1. Enable Non-critical CSS for the default theme (and SDC Critical CSS as documented).
  2. Open a Canvas editor URL, e.g. /canvas/editor/canvas_page/{id}.
  3. Editor styles are broken. Public pages of the same site are OK.

Observed on Drupal CMS Canvas site templates (e.g. Convene).

Proposed resolution

Add a skip in shouldOptimizeCssDelivery() (or equivalent) before async rendering. Mirror SDC Critical CSS:

  • _admin_route
  • _hide_admin_toolbar
  • Sec-Fetch-Dest: iframe
  • _mercury_editor_route
  • route name matching mercury_editor.* / *.mercury_editor_preview / canvas.*
  • path prefix /mercury-editor or /canvas/

No hard dependency on Canvas or Mercury. Optional alter hook later if other editors need an in. Keep the oEmbed skip.

Remaining tasks

  • Implement the skip; do not async CSS on those requests.
  • Tests for Canvas editor path, admin route, iframe, oEmbed still skipped.
  • README: editorial overlays are skipped; public pages unchanged.

User interface changes

None.

API changes

None for existing settings. New skip is request-time only.

Data model changes

None.

Comments

drale01 created an issue. See original summary.

  • drale01 committed fd2a63f8 on 1.0.x
    Issue #3631048 by drale01: Skip async CSS on Canvas editor and other...
drale01’s picture

Status: Active » Fixed

Committed to 1.0.x: https://git.drupalcode.org/project/non_critical_css/-/commit/fd2a63f

Async remaining CSS is skipped on Canvas editor, Mercury Editor, admin/iframe overlays. Tested on Convene Canvas editor. Public pages still use async delivery.

Related: #3631045

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • drale01 committed d47b2d6a on 1.0.x
    Issue #3631048 by drale01: Give the Canvas kernel test a mock session.
    

  • drale01 committed 206d0e52 on 1.0.x
    Issue #3631048 by drale01: End skip-list docblock with a full stop.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.