-
Notifications
You must be signed in to change notification settings - Fork 306
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
Apply styles to ShadowDOM #739
Comments
I don't think the two issues are really related. Embedded tweets are displayed within the shadow DOM, and are therefore mostly off-limits to the end user. In fact, they're specifically referenced in this shadow DOM explanation. Used to be you could use the pseudo-selector Those methods of interacting with shadow DOM elements, were replaced by I think the real reason the new spec is a shadow of its former self (pun intended), is because the powers that be want it that way. Chris said in that article "It's a totally understandable need for control". I don't agree that the need for control is understandable, but I understand why they want it. Personally, I think using the shadow DOM for stuff like this is anal, and anti-user, but currently there's no workaround I'm aware of. |
@narcolepticinsomniac I wrote a demo extension (link) to restyle shadows via Constructable Stylesheets API (Chrome-only) so arguably it can be implemented in Stylus. |
That's a neat trick.
If Chromium 73+ has a workaround for styling the shadow DOM, I don't see why we wouldn't take advantage of it. Are you inclined to hook it up? |
I can help certainly if needed but I thought @eight04 who is actively maintaining the code would be a better match. |
Makes sense. Let's see what he thinks. |
While not strictly necessary to write a working theme, it might be nice to design a way of targeting specific shadowed elements, which should simplify styling and [theoretically] increase performance. For example we could abuse an AT-rule: @-webkit-shadow (:not(gr-main-header):not(gr-endpoint-decorator)) {
a:visited {
color: #e094f3;
}
} Since Stylus uses a custom parserlib anyway, it could extend the syntax easily. |
The API looks promising. I think we can implement a Perhaps we can reopen this issue first? Currently, I'm working on a sync controller: https://github.com/eight04/db-to-cloud |
It would be great to have it working, both on Chromium and Firefox, as DOM shadowing gets more common. |
Maybe not ideal, but this script appears to work pretty decently. |
@narcolepticinsomniac The script works perfectly, thanks. It's configured to run on every website though. I'm not familiar with observing, but it sounds like something that may affect performance, so it's probably a good idea to configure the script to run only on websites one needs. |
@narcolepticinsomniac Confirmed (and if only to bump this enhancement request). However, "Live Update" does not seem to work: One has to reload the page to get any style updates from the Stylus editor. |
Although the Greasemonkey/Tampermonkey script works, I don't think it is a viable solution.
I hope some solution can be found that would run within stylus itself! |
Now that adoptedStyleSheets allows |
To style the WayBackMachine to remove their Subscribe top banner,
Note: For that, i tested the before mentioned userscript, without luck: Maybe it seems due the shadow DOM is "(closed)"... But i found an other one userscript which do the job perfectly: As mentioned for the previous userscript, the Live Edit of Stylus don't work when you work on shadow DOM: Related post (with screenshots): Because this script is different, maybe something like that can be implemented in Stylus? The other solution "adoptedStyleSheets" seems possible too, but i don't understand how to use it with Stylus: I found, but not tested yet, which should do the job: It's possible to have it include in Stylus ? |
The "answers" provided are akin to someone saying, "Waldo can be found in Waldo books." Like seriously? Could someone post actual Shadow DOM HTML and CSS so we have a way to test and verify how it actually works? 🙄︀ |
Is there any progress on this idea? |
Blurbed this issue into w3c/webcomponents-cg#92 (comment) |
* { background-color: pink !important; }
This was filed under #215, which was for Firefox and a comment was made that it works in Chrome, but I am not seeing it.
The text was updated successfully, but these errors were encountered: