openy icon indicating copy to clipboard operation
openy copied to clipboard

Open Y Lily theme uses blocks IDs with name of the theme inside for CSS rules.

Open afi13 opened this issue 5 years ago • 4 comments

Problem Lily theme uses blocks CSS selectors which contains the hardcoded name of the theme as ID of elements. Such approach is not flexible. It creates issues for all sub-themes inherited from Lily. Selectors don't work because any sub-theme has another name and another ID of blocks. Examples of wrong selectors: #block-openy-lily-branding, #block-openy-lily-footercopyrightblock, #block-openy-lily-footersocialblock, #block-openy-lily-googletranslate, etc

Proposed resolution Refactor Lily theme to replace all hardcoded selectors like #block-openy-lily-* with corresponding classes which are not related to the theme name.

afi13 avatar Jun 25 '19 08:06 afi13

@afi13 this is slippery slope When you implement subtheme what should be more important - to keep base theme branding, or to allow subtheme to provide own. I guess we can live with current solution, because we don't have any data that proves branding should be inherited in subtheme. I remember in the past we have a request to rely on theme name to be able to have different experiences for different themes. Why would you call #block-openy-lily-branding, #block-openy-lily-footercopyrightblock, #block-openy-lily-footersocialblock, #block-openy-lily-googletranslate as wrong selectors? Could you provide more details about issues your are facing with before naming this as a bug?

podarok avatar Jun 25 '19 15:06 podarok

@podarok A sub-theme inherits all styles from parent theme by default because this is the main point for sub-themes - they inherit the parent theme's resources. But it doesn't work with Open Lily out of the box. Example: You use Open Y with Lily theme on your website. All pages look ok for you, but you want to add small changes in HTML of Branch nodes. In the current implementation, you can't just create sub-theme from Lily and override the branch node template. Because the branch pages will be broken and you must copy-paste a lot of CSS from the parent theme with renamed selectors to fix that. I don't think it's a good approach. I can do that with any Drupal contrib theme, but not with Open Y lily. I hope it's more clear now. Also using ID in CSS selectors is not very good practice.

afi13 avatar Jun 25 '19 17:06 afi13

@afi13 let me know if this could be fixed in the scope of YGTC CMS Optimization project

podarok avatar Jul 17 '19 12:07 podarok

Reference to this item: https://github.com/ymcatwincities/openy/issues/1307 - once 1307 is closed, this item can be closed as well.

sarah-halby avatar Nov 02 '20 14:11 sarah-halby