<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Nette Framework forum : Development of Nette Framework : Discussion on development : Please test Tracy 2.13 RC – Tracy in its own Shadow DOM</title>
<link>https://forum.nette.org/en</link>
<description>Nette Framework forum</description>
<language>en</language>
<docs>http://backend.userland.com/rss</docs>
<item>
	<title>Please test Tracy 2.13 RC – Tracy in its own Shadow DOM (Discussion on development)</title>
	<dc:creator>David Grudl</dc:creator>
	<link>https://forum.nette.org/en/36993#p229146</link>
	<guid isPermaLink="false">229146@http://forum.nette.org/en</guid>
	<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I&apos;d like to ask you to test &lt;strong&gt;Tracy 2.13.0-RC1&lt;/strong&gt;. The main
change is invisible at first sight: the Bar, BlueScreen and dumps now render
into their own Shadow DOM, so the styles of your page and the styles of Tracy
finally leave each other alone.&lt;/p&gt;

&lt;pre
class=&quot;language-bash&quot;&gt;&lt;code&gt;composer require tracy/tracy:^2.13.0-RC1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is something I&apos;ve been after ever since the Tracy Bar was born. The Bar
lives inside someone else&apos;s page, and that page does whatever it likes with it:
Bootstrap or Tailwind restyle it, and the other way round, Tracy&apos;s CSS sometimes
bent the page&apos;s tables. Over the years there were many attempts to deal with it,
but every one of them was some form of out-specifying the page: everything
hidden behind the &lt;code&gt;#tracy-debug&lt;/code&gt; prefix, resetting inherited
properties, selectors like &lt;code&gt;tracy-div:not(a b)&lt;/code&gt; whose only purpose
was to add specificity. There was no general solution, there was always a page
that won. Now and then a CSS property appeared that looked promising, but it
never got me there, because it simply wasn&apos;t meant for this. And CSS planned
various forms of scoping that never came to be.&lt;/p&gt;

&lt;p&gt;Then, more or less by accident, I found out it could be done with Shadow DOM.
Which turned out to be a brutally hard nut to crack, because everything has to
move in there: styles, scripts, events, dragging panels, BlueScreen and dumps. I
wasn&apos;t sure about it, so it&apos;s been sitting in the repository for a couple of
years. Now it&apos;s time to test it and let it out.&lt;/p&gt;

&lt;h4&gt;How to test&lt;/h4&gt;

&lt;p&gt;Just install it and work as usual for a while: click through the panels in
the Bar (especially those from other packages and your own), throw an exception
and look at the BlueScreen, dump something. &lt;strong&gt;The ideal outcome is that
you notice nothing.&lt;/strong&gt; If nobody finds anything, great, I&apos;ll release the
stable version.&lt;/p&gt;

&lt;h4&gt;What may affect your code&lt;/h4&gt;

&lt;ul&gt;
	&lt;li&gt;Styles and scripts of the page no longer reach inside Tracy. Code that
	targeted &lt;code&gt;#tracy-debug&lt;/code&gt;, &lt;code&gt;#tracy-bs&lt;/code&gt;,
	&lt;code&gt;&amp;lt;tracy-div&amp;gt;&lt;/code&gt; or the inside of a dump (e.g.
	&lt;code&gt;document.querySelector(&apos;#tracy-debug&apos;)&lt;/code&gt;) finds nothing now.&lt;/li&gt;

	&lt;li&gt;A custom panel that relied on the page&apos;s styles has to ship its own CSS in
	its markup. The &lt;code&gt;#tracy-debug&lt;/code&gt; wrapper is kept inside the Shadow DOM,
	so the selectors in existing panel CSS keep working.&lt;/li&gt;

	&lt;li&gt;The &lt;code&gt;ext-tokenizer&lt;/code&gt; extension is now required, and the Nette
	integration needs &lt;code&gt;nette/di&lt;/code&gt; and &lt;code&gt;nette/mail&lt;/code&gt;
	3.1 or newer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Other new features&lt;/h4&gt;

&lt;ul&gt;
	&lt;li&gt;The Bar lives in the top layer (Popover API), so it stays above the page&apos;s
	overlays and sticky headers whatever their z-index.&lt;/li&gt;

	&lt;li&gt;Tracy works on pages with a strict CSP and Trusted Types
	(&lt;code&gt;require-trusted-types-for &apos;script&apos;&lt;/code&gt;) through a policy named
	&lt;code&gt;tracy&lt;/code&gt;. Styles no longer need &lt;code&gt;&apos;unsafe-inline&apos;&lt;/code&gt; in
	&lt;code&gt;style-src&lt;/code&gt;. Thanks to adrianbj for the Trusted Types support (&lt;a
	href=&quot;https://github.com/nette/tracy/issues/616&quot;&gt;nette/tracy#616&lt;/a&gt;).&lt;/li&gt;

	&lt;li&gt;&lt;code&gt;Debugger::$dumpTheme = &apos;auto&apos;&lt;/code&gt; switches dumps between light and
	dark according to the system setting.&lt;/li&gt;

	&lt;li&gt;Toggles in dumps and panels can be operated with the keyboard (Tab, Enter,
	Space), and dragging the Bar and its panels works reliably on touch
	screens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If something breaks or a panel looks different than before, please let me
know. And feel free to say that everything works, too, that&apos;s just as useful to
me. Thanks!&lt;/p&gt;
</description>
	<pubDate>Tue, 01 Dec 2026 17:46:52 +0100</pubDate>
</item>
</channel>
</rss>
