-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow additional characters in backdrop_clean_css_identifier() #6748
Comments
Proposed code changes: % diff common.inc common.inc.new
|
Previous diff is wrong. The Drupal issue does not properly list the Unicode characters in HEX order. Correct preg pattern line should be:
Alternately, the syntax could be shortened to the following, but then the alphanumeric ranges would not be specifically listed.
|
Looking through the Drupal issue queue, there were some concerns about backwards compatibility but those seem to be tied to Twig. |
@tkcent - You are the one working on a possible new contrib theme, right? Is this blocking you at all? Or does this just limit how people are able to use the classes in your new theme in the UI? Are you able to create a PR for this issue? |
@stpaultim Correct, I am working on a new theme based on UIkit. It doesn't necessarily block me, because I can work around things by modifying template files, but it would definitely make it easier for non-technical users to be able to use the classes right in the layout settings. PR already created! 👆🏻 |
Does views use something different than backdrop_clean_css_identifier? Because I am running into this problem with views global text. I applied the patch above and it is still striping out classes with |
Aha! Had to dig a little on this one. The custom text is run through filter_xss_admin()... ...which eventually gets around to calling backdrop_strip_dangerous_protocols(). Guess what it uses to parse protocols like http, ftp, etc. Spoiler alert... It's the colon. backdrop_strip_dangerous_protocols You can use the Style settings within a custom text field to specify css classes which get passed through properly. |
Inspired by Drupal issue: https://www.drupal.org/project/drupal/issues/2916377
Description of the need
Escaped characters in CSS classes are valid. Several popular CSS/Sass libraries use escaped characters (particularly ones which use the BEM methodology) to denote special uses or characteristics of a CSS class.
For instance, the inuitcss CSS library uses the @ character in CSS classes for identifying responsive breakpoint classes and the forward slash / character for fractional grid column classes.
Other examples include Tailwind CSS (colon and slash) and UIkit (at).
Proposed solution
Update backdrop_clean_css_identifier() to include additional special characters.
Alternatives that have been considered
None.
Additional information
This will allow responsive class names to be used in Style settings of Layout regions.
Draft of feature description for Press Release (1 paragraph at most)
Backdrop doesn't filter special characters in class names used in popular CSS frameworks such as Tailwind CSS and UIkit.
The text was updated successfully, but these errors were encountered: