D10 Compatibility AddCssCommand() - AJAX error for css route of webform assets

Created on 25 September 2023, about 1 year ago
Updated 16 August 2024, 3 months ago

Problem/Motivation

If the webform has the custom CSS and this is added in a block. For the logged in users block is not loading, showing the AJAX error.

Refused to execute script from 'https://dev.gavi.org/webform/css/feedback?s1agpk&s1agpk' because its MIME type ('text/css') is not executable, and strict MIME type checking is enabled.
 
An error occurred during the execution of the Ajax response: The following files could not be loaded: /webform/css/feedback?s1agpk&s1agpk0

Steps to reproduce

  1. Create a Webform
  2. Add CSS to the webform
  3. Configure Form dialog settings and add Open Dialog link that will open a webform dialog to any page - instruction is here https://www.youtube.com/watch?v=zmRxyUHWczw
  4. Click on the Open Dialog
  5. Expected: The webform must be opened without any errors
  6. Actual: we see MIME type ('text/css') is not executable JS error and dialog won't be opened

Proposed resolution

Make the route compatible with D10 AddCssCommand(). For that, we just need to add 'css' extension to the path - because of https://github.com/muicss/loadjs/blob/master/dist/loadjs.js#L113

🐛 Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

🇮🇳India sivaprasadc

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024