You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Back in #3943, we started rendering text editor contents inside a shadow DOM boundary to prevent outer style sheets from altering the editor inner contents. Although this introduced many benefits, it carried several tradeoffs too.
In particular, we started duplicating some of the style sheets ({context: 'atom-text-editor'}) inside each shadow root so that package and theme authors could still be able to explicitly target the editor visual elements. An alternative solution to this problem that we suggested (before the shadow DOM spec was finalized) was to use /deep/ and ::shadow pseudo selectors, which unfortunately are now being deprecated.
Even more importantly, this architecture was getting in the way of making atom-text-editor a reusable component, because it made it even more coupled to Atom and its ecosystem. Other problems involved things like #4590, and a more complex user experience for package and theme authors in general. Ultimately, we started feeling like the extra complexity of the shadow DOM wasn't worth its benefits.
Removing shadow DOM from atom-text-editor
This pull request aims at removing the shadow DOM in a way that prevents elements within atom-text-editor that we don't fully control (i.e. the grammar scopes applied as CSS classes to every line's inner <span>) from being mistakenly styled from the outside. Specifically, every syntactic class name will now be prepended with syntax--; styling a JavaScript operator, for example, should now look like the following:
Given the wide scope of this change, we are trying to reduce package breakage to a minimum by transforming deprecated selectors automatically and emitting a deprecation in deprecation-cop. Applying these transformations can be quite onerous and therefore we have introduced a layer of caching in 07d56b2 to ensure their performance impact stays low after the first time Atom is launched.
Other notable changes include:
Block decorations rendering has been rewritten from scratch (it previously worked only with the shadow DOM).
When the editor is focused, document.activeElement will now return the hidden <input> inside atom-text-editor, instead of atom-text-editor itself. I could find only one third party package relying on this behavior, and I am going to submit a pull request shortly to use document.activeElement.closest('atom-text-editor') instead.
Rendering flashes for decorations has been broken for a long time, but removing the shadow DOM highlighted the cause of the issue, and so they have been fixed in 1091b0e.
Conclusion
Removing the shadow DOM is an important step for the editor's future, as doing so will allow us to extract it, clean it up and optimize it. Considering the invasive nature of this change, we are planning to 🚢 it after rolling the railcars next week, so that everyone can build it from master and extensively test it for an entire release cycle.
Before merging this, we will also need to merge the following core package pull requests, so that we stop using any deprecated API or selector, and make the test suite green again:
Background
Back in #3943, we started rendering text editor contents inside a shadow DOM boundary to prevent outer style sheets from altering the editor inner contents. Although this introduced many benefits, it carried several tradeoffs too.
In particular, we started duplicating some of the style sheets (
{context: 'atom-text-editor'}
) inside each shadow root so that package and theme authors could still be able to explicitly target the editor visual elements. An alternative solution to this problem that we suggested (before the shadow DOM spec was finalized) was to use/deep/
and::shadow
pseudo selectors, which unfortunately are now being deprecated.Even more importantly, this architecture was getting in the way of making
atom-text-editor
a reusable component, because it made it even more coupled to Atom and its ecosystem. Other problems involved things like #4590, and a more complex user experience for package and theme authors in general. Ultimately, we started feeling like the extra complexity of the shadow DOM wasn't worth its benefits.Removing shadow DOM from
atom-text-editor
This pull request aims at removing the shadow DOM in a way that prevents elements within
atom-text-editor
that we don't fully control (i.e. the grammar scopes applied as CSS classes to every line's inner<span>
) from being mistakenly styled from the outside. Specifically, every syntactic class name will now be prepended withsyntax--
; styling a JavaScript operator, for example, should now look like the following:Given the wide scope of this change, we are trying to reduce package breakage to a minimum by transforming deprecated selectors automatically and emitting a deprecation in deprecation-cop. Applying these transformations can be quite onerous and therefore we have introduced a layer of caching in 07d56b2 to ensure their performance impact stays low after the first time Atom is launched.
Other notable changes include:
Block decorations rendering has been rewritten from scratch (it previously worked only with the shadow DOM).
When the editor is focused,
document.activeElement
will now return the hidden<input>
insideatom-text-editor
, instead ofatom-text-editor
itself. I could find only one third party package relying on this behavior, and I am going to submit a pull request shortly to usedocument.activeElement.closest('atom-text-editor')
instead.Any Grim or style sheet deprecation will now cause specs to fail, see
ensureNoDeprecatedFunctionCalls
andensureNoDeprecatedStylesheets
.Rendering flashes for decorations has been broken for a long time, but removing the shadow DOM highlighted the cause of the issue, and so they have been fixed in 1091b0e.
Conclusion
Removing the shadow DOM is an important step for the editor's future, as doing so will allow us to extract it, clean it up and optimize it. Considering the invasive nature of this change, we are planning to 🚢 it after rolling the railcars next week, so that everyone can build it from master and extensively test it for an entire release cycle.
Before merging this, we will also need to merge the following core package pull requests, so that we stop using any deprecated API or selector, and make the test suite green again:
scopeSelector.toCss()
to return prefixed syntax selectors atom/first-mate#80)/cc: exit
__Originally posted by @as-cii in https://github.com/atom/atom/pull/12903__start
The text was updated successfully, but these errors were encountered: