Compatibility with Next.js

Created on 16 May 2023, about 1 year ago
Updated 5 October 2023, 9 months ago

Problem/Motivation

This is a terrific module, and many thanks to everyone whose work make this such a robust solution.

It would be great if this module could support use cases where Drupal is being used as a headless CMS. Obviously the challenge is the decoupled architecture, but the Next.js Drupal module provides a preview capability that allows a content author to see their content rendered through the front end, within an iframe in the Drupal CMS. Could this module's JS scan content within the iframe?

Proposed resolution

Provide an option to scan content embedded within an iframe, to allow for reporting on headless pages.

✨ Feature request
Status

Closed: won't fix

Version

2.0

Component

Feature and test requests

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 itmaybejj

    Well -- it's impossible for JS to "see" from a container into an iframe, so the JS is going to have to be injected into the decoupled theme itself, inside the iframe.

    Probably the easiest approach would be a little loader JS that detects preview mode -- e.g., if the page is loaded with a particular query variable that would be set by the iframe, then include the Editoria11y JS library. That would provide all the checking and highlighting functions, and authors could use "ignore" buttons via localStorage -- the API and the Drupal module are only needed to provide a GUI for configuration, and for syncing dismissals.

    If you wanted to phone home to the API, to write information to the dashboard and enable the "mark as OK for all users" buttons...well...that there would be a bit of a puzzle to solve for sending that data. I don't know if anything is built into the Next.js module to interact directly with the Drupal JSONAPI; I piggyback the Drupal API and its XSS tokens directly for my API JS. If some method for calling for Drupal tokens is available on the headless pages, this might actually be pretty turnkey -- we'd just need to make sure the decoupled pages have a bit of JS to call my files and provide them with the right config variables.

    I can backseat drive this effort if anybody wants to work on it, but I can't volunteer to lead it.

  • Status changed to Closed: won't fix 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States itmaybejj
Production build 0.69.0 2024