Skip to content

GAUD-8854: Make offscreen styles node safe#7199

Merged
GZolla merged 2 commits into
mainfrom
gzolla/offscreen-node
Jul 13, 2026
Merged

GAUD-8854: Make offscreen styles node safe#7199
GZolla merged 2 commits into
mainfrom
gzolla/offscreen-node

Conversation

@GZolla

@GZolla GZolla commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

GAUD-8854

BSI needs to import these styles, document and customElements won't allow it.

@GZolla GZolla requested a review from a team as a code owner July 10, 2026 21:21
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-7199/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just curious why you decided to move the code into its own file. Is there something special that made you did that ?

@dlockhart dlockhart Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's so that they can be imported in a Node environment without also registering the <d2l-offscreen> web component. customElements.define won't be defined in Node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn´t expanded the existing file so I didn't see the web component. That makes total sense! nice!

import { css } from 'lit';
import { getFlag } from '../../helpers/flags.js';

const OffSCREEN_SIZELESS = getFlag('d2l-offscreen-sizeless', true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI, the flag will be always-true when this is called from Node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I added HAS_DOCUMENT as a guard to default to 1px(as if the flag was off). I'll make a separate PR to remove that guard and just use 0 when the flag is removed

@GZolla GZolla merged commit ece19bb into main Jul 13, 2026
8 of 9 checks passed
@GZolla GZolla deleted the gzolla/offscreen-node branch July 13, 2026 18:31
@d2l-github-release-tokens

Copy link
Copy Markdown

🎉 This PR is included in version 3.270.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants