summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenaud Chaput <renchap@gmail.com>2024-01-12 10:32:45 +0100
committerGitHub <noreply@github.com>2024-01-12 09:32:45 +0000
commitc6684aa1e392f2dd86af4362b4259809549abaad (patch)
treeda74996a285b45c9e3c60b9f09431d0681fcc50c
parenta90696011e563e62100cba56e2d52f6babbaff00 (diff)
Use the assets pipeline to load `inert.css` (#28701)
-rw-r--r--app/javascript/packs/inert.js4
-rw-r--r--app/javascript/styles/inert.scss (renamed from public/inert.css)2
-rwxr-xr-xapp/views/layouts/application.html.haml4
3 files changed, 9 insertions, 1 deletions
diff --git a/app/javascript/packs/inert.js b/app/javascript/packs/inert.js
new file mode 100644
index 00000000000..7c04a97fafd
--- /dev/null
+++ b/app/javascript/packs/inert.js
@@ -0,0 +1,4 @@
+/* Placeholder file to have `inert.scss` compiled by Webpack
+ This is used by the `wicg-inert` polyfill */
+
+import '../styles/inert.scss';
diff --git a/public/inert.css b/app/javascript/styles/inert.scss
index 54e10616d2e..a60045d7be8 100644
--- a/public/inert.css
+++ b/app/javascript/styles/inert.scss
@@ -1,3 +1,5 @@
+/* This is needed for the wicg-inert polyfill */
+
[inert] {
pointer-events: none;
cursor: default;
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 1244fd5eb36..6f6b1825f6c 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -28,12 +28,14 @@
= stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous'
= stylesheet_pack_tag current_theme, media: 'all', crossorigin: 'anonymous'
+ -# Needed for the wicg-inert polyfill. It needs to be on it's own <style> tag, with this `id`
+ = stylesheet_pack_tag 'inert', media: 'all', id: 'inert-style'
+
= javascript_pack_tag 'common', crossorigin: 'anonymous'
= preload_pack_asset "locale/#{I18n.locale}-json.js"
= csrf_meta_tags unless skip_csrf_meta_tags?
%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }
- = stylesheet_link_tag '/inert.css', skip_pipeline: true, media: 'all', id: 'inert-style'
= stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all'
= yield :header_tags