Update SVG Namespace to HTTPS for Contextual Icons

Created on 7 August 2024, 5 months ago

Problem/Motivation

Trying to implement different Security Policies, and Contextual Icons get removed because SVG is listed as xmlns='http://www.w3.org/2000/svg'

/core/modules/contextual/css/contextual.icons.theme.css

Checkboxes also need to be fixed /core/themes/claro/css/components/form--checkbox-radio.css

Steps to reproduce

Implement Content-Security-Policy will block http calls

Proposed resolution

Update contextual.icons.theme.css:

    /*
     * DO NOT EDIT THIS FILE.
     * See the following change record for more information,
     * https://www.drupal.org/node/3084859
     * @preserve
     */

    /**
     * @file
     * Styling for contextual module icons.
     */

    /**
     * Toolbar tab icon.
     */

    .toolbar-bar .toolbar-icon-edit::before {
      background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23bebebe' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23bebebe' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23bebebe' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
    }

    .toolbar-bar .toolbar-icon-edit:active::before,
    .toolbar-bar .toolbar-icon-edit.is-active::before {
      background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23ffffff' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23ffffff' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23ffffff' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
    }

    /**
     * Contextual trigger.
     */

    .contextual .trigger {
      /* Override the .focusable height: auto */
      width: 26px !important;
      /* Override the .focusable height: auto */
      height: 26px !important;
      text-indent: -9999px;
      background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23bebebe' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23bebebe' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23bebebe' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
      background-repeat: no-repeat;
      background-position: center center;
      background-size: 16px 16px;
    }

    .contextual .trigger:hover {
      background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%23787878' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%23787878' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%23787878' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
    }

    .contextual .trigger:focus {
      outline: none;
      background-image: url("data:image/svg+xml,%3csvg xmlns='https://www.w3.org/2000/svg' width='16' height='16'%3e%3cg%3e%3cpath fill='%235181C6' d='M14.545 3.042l-1.586-1.585c-.389-.389-1.025-.389-1.414 0l-1.293 1.293 3 3 1.293-1.293c.389-.389.389-1.026 0-1.415z'/%3e%3crect fill='%235181C6' x='5.129' y='3.8' transform='matrix(-.707 -.707 .707 -.707 6.189 20.064)' width='4.243' height='9.899'/%3e%3cpath fill='%235181C6' d='M.908 14.775c-.087.262.055.397.316.312l2.001-.667-1.65-1.646-.667 2.001z'/%3e%3c/g%3e%3c/svg%3e");
    }

Remaining tasks

API page will need to be updated as well - https://api.drupal.org/api/drupal/core%21modules%21contextual%21css%21co...

User interface changes

Introduced terminology

API changes

contextual.icons.theme.css

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ContextualΒ  β†’

Last updated 3 months ago

Created by

πŸ‡ΊπŸ‡ΈUnited States bdh676 Springfield, MA

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