basecamp / basecamp/trix

CSS universal selector started breaking things

Open
#976 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

We noticed that our custom attachments started to look really weird since [this rule](https://github.com/basecamp/trix/blob/b6c0047f87fa078aa65beb8ba297aba32ea4bcf1/assets/trix/stylesheets/content.scss#L8)

BEFORE THE RESET | AFTER THE RESET
:--|:--
![Captura de Pantalla 2022-05-18 a las 16 11 51](https://user-images.githubusercontent.com/11319279/169074735-d1b9b75e-2f74-4aec-b31a-f225f189c5b3.png) | ![Captura de Pantalla 2022-05-18 a las 16 14 24](https://user-images.githubusercontent.com/11319279/169074739-70287ba2-1bf5-44d3-afc4-4edf3893fe75.png)

---

It resets margin and padding of every node:

![Captura de Pantalla 2022-05-18 a las 17 26 29](https://user-images.githubusercontent.com/11319279/169081107-6d4dae22-718a-4e44-a2d6-7e3cea24b1e5.png)

In this case, universal selector `*` is breaking our custom attachment styles.
We could not solve it via increasing selector specificity, so that we added (with real pain 😢 ) the `!important` on each `margin`/`padding` property setting for our Trix custom attachements.

We though that maybe... what if selector could be like `.trix-content :not(action-text-attachment) *`? 🤔

How could we omit that universal reset of margin and padding?
Any other idea we could implement?

(Rails 7.0.3)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.