Skip to content

Commit abbbd8f

Browse files
bdonecastastrophekylebuch8
authored
docs: Add FOUC docs to getting started README FAQ (#549) (#742)
* docs: Add fouc docs to getting started readme faq (#549) * Update docs/content/getting-started/_index.md Co-Authored-By: [ Cassondra ] <[email protected]> * Update docs/content/getting-started/_index.md Co-Authored-By: [ Cassondra ] <[email protected]> * docs: Add fouc docs to getting started readme faq (#549) * docs: Removed body ex from getting started readme faq (#549) Co-authored-by: [ Cassondra ] <[email protected]> Co-authored-by: Kyle Buchanan <[email protected]>
1 parent afd7d6e commit abbbd8f

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

docs/content/getting-started/_index.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,19 @@ Different components have different intended uses. We tend to think of them in 3
6363
The beauty of web components is that they have much of the styling built-into the tag itself. Start with the tags first.
6464

6565
```
66-
<body>
67-
<pfe-cta>
68-
<a href="#">Learn more</a>
69-
</pfe-cta>
70-
</body>
66+
<pfe-cta>
67+
<a href="#">Learn more</a>
68+
</pfe-cta>
7169
```
7270

7371

7472

7573
### Container components (see also container notes below)
7674

7775
```
78-
<body>
79-
<pfe-card pfe-color="darkest">
80-
<p>Hello world.</p>
81-
</pfe-card>
82-
</body>
76+
<pfe-card pfe-color="darkest">
77+
<p>Hello world.</p>
78+
</pfe-card>
8379
```
8480

8581

@@ -239,3 +235,8 @@ You can optionally customize your broadcast variables individually if you have v
239235
* `--pfe-broadcasted--link-decoration--focus`
240236

241237
If you include the `pfe-base.css` stylesheet, it will include application of these broadcast variables to links; this is helpful because links are often nested inside of p tags in the content and thus inaccessible to the stylesheet of the web component.
238+
239+
### How to avoid FOUC (Flash of Unstyled Content) with the body unresolved attribute
240+
241+
PatternFly Elements provides a stylesheet that causes the `body[unresolved]` attribute to avoid the Flash of Unstyled Content (FOUC).
242+
Adding the unresolved attribute to the `body` tag will hide the entire page until all elements have upgraded or 2 seconds have passed, whichever happens first. By including the `pfelement--noscript.css` file (wrapped in a `noscript` tag), all content will be revealed immediately for pages without JavaScript turned on. To customize the wait time, update the value of the `--pfe-reveal-delay` variable (default 2 second delay) and the `--pfe-reveal-duration` variable (how long the reveal animation takes, default 0.1618 seconds).

elements/pfe-styles/demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
}
9999
</style>
100100
</head>
101-
<body>
101+
<body unresolved>
102102

103103
<article>
104104
<header>

elements/pfelement/test/fouc-test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2 slot="pfe-card--header">Card 1</h2>This is pfe-card.
2929
3030
A note about these tests. PFElements provides a stylesheet that causes
3131
the body[unresolved] attribute to hide the page. It's very similar to
32-
Polymer's approach. The Web Component Tester automatically injets
32+
Polymer's approach. The Web Component Tester automatically injects
3333
Polymer's CSS into this page. That means that both PFElements' and
3434
Polymer's CSS is present on this page. Be cautious of that when
3535
writing tests.

0 commit comments

Comments
 (0)