Skip to content

Commit 5fe7c43

Browse files
fix(back-to-top): demo visibility and logical properties (#2133)
* fix(back-to-top): make element visible on base demo * fix(back-to-top): fix warnings demo, update demo content * fix(back-to-top): show element on position sticky demo * fix(back-to-top): use logical properties in demo styles * fix(back-to-top): target surface with `main` role in demo JS * chore(back-to-top): add changeset * fix(back-to-top): revert `svb` due to lack of baseline browser support * docs(back-to-top): remove position sticky demo * docs(back-to-top): remove scrollable page demo * fix(back-to-top): remove error/warning logs and warnings demo * chore(back-to-top): update changeset --------- Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
1 parent 2de4fc7 commit 5fe7c43

File tree

10 files changed

+35
-229
lines changed

10 files changed

+35
-229
lines changed

.changeset/large-buckets-cough.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": patch
3+
---
4+
5+
`<rh-back-to-top>`: remove user-facing errors and warnings from missing attributes/values from the console

elements/rh-back-to-top/demo/always-visible.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
main {
99
display: block;
1010
scroll-behavior: smooth;
11-
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
11+
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
1212
}
1313
#bottom {
1414
position: absolute;
15-
bottom: 0;
15+
inset-block-end: 0;
1616
}
1717
#nav {
18-
height: calc(100dvh - var(--pf-demo-header-height, 4.375rem)); !important;
18+
block-size: calc(100dvh - var(--pf-demo-header-height, 4.375rem)); !important;
1919
}
2020
</style>

elements/rh-back-to-top/demo/color-context.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@
3333
main {
3434
display: block;
3535
scroll-behavior: smooth;
36-
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
36+
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
3737
}
3838

3939
#nav {
40-
height: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
40+
block-size: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
4141
}
4242

4343
#overflow {
44-
min-height: calc(100dvh + 401px);
44+
min-block-size: calc(100dvh + 401px);
4545
position: relative;
4646
}
4747

4848
#bottom {
4949
position: absolute;
50-
bottom: 0;
50+
inset-block-end: 0;
5151
}
5252

5353
@media (prefers-reduced-motion: reduce) {
@@ -61,7 +61,7 @@
6161
<script type="module">
6262
/* add support for demo/fullscreen and dev server */
6363
const b2t = document.querySelector('rh-back-to-top');
64-
const main = document.querySelector('main');
64+
const main = document.querySelector('main, [role="main"]');
6565
// if main isn't scrollable use window
6666
if (window.getComputedStyle(main).overflow === 'scroll') {
6767
b2t.scrollableSelector = 'main';

elements/rh-back-to-top/demo/no-slotted-text.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
main {
1414
display: block;
1515
scroll-behavior: smooth;
16-
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
16+
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
1717
}
1818

1919
#nav {
20-
height: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
20+
block-size: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
2121
}
2222

2323
#overflow {
24-
min-height: calc(100dvh + 401px);
24+
min-block-size: calc(100dvh + 401px);
2525
position: relative;
2626
}
2727

2828
#bottom {
2929
position: absolute;
30-
bottom: 0;
30+
inset-block-end: 0;
3131
}
3232

3333
@media (prefers-reduced-motion: reduce) {
@@ -39,7 +39,7 @@
3939
<script type="module">
4040
/* add support for demo/fullscreen and dev server */
4141
const b2t = document.querySelector('rh-back-to-top');
42-
const main = document.querySelector('main');
42+
const main = document.querySelector('main, [role="main"]');
4343
// if main isn't scrollable use window
4444
if (window.getComputedStyle(main).overflow === 'scroll') {
4545
b2t.scrollableSelector = 'main';

elements/rh-back-to-top/demo/on-a-scrollable-page.html

Lines changed: 0 additions & 48 deletions
This file was deleted.

elements/rh-back-to-top/demo/position-sticky.html

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
<div id="overflow">
2+
<p>Scroll down to reveal the back to top element</p>
23
<rh-back-to-top href="#">Back to top</rh-back-to-top>
34
</div>
45

56
<script type="module">
67
import '@rhds/elements/rh-back-to-top/rh-back-to-top.js';
78
</script>
9+
10+
<style>
11+
#overflow {
12+
min-block-size: calc(100dvh + 401px);
13+
}
14+
15+
p {
16+
font-weight: bold;
17+
}
18+
</style>

elements/rh-back-to-top/demo/scroll-distance.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
main {
1313
display: block;
1414
scroll-behavior: smooth;
15-
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
15+
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
1616
}
1717

1818
#nav {
19-
height: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
19+
block-size: calc(100dvh - var(--pf-demo-header-height, 4.375rem)) !important;
2020
}
2121

2222
#overflow {
2323
/* scroll distance set to 50px */
24-
min-height: calc(100dvh + 51px);
24+
min-block-size: calc(100dvh + 51px);
2525
position: relative;
2626
}
2727

2828
#bottom {
2929
position: absolute;
30-
bottom: 0;
30+
inset-block-end: 0;
3131
}
3232

3333
@media (prefers-reduced-motion: reduce) {
@@ -41,7 +41,7 @@
4141
<script type="module">
4242
/* add support for demo/fullscreen and dev server */
4343
const b2t = document.querySelector('rh-back-to-top');
44-
const main = document.querySelector('main');
44+
const main = document.querySelector('main, [role="main"]');
4545
// if main isn't scrollable use window
4646
if (window.getComputedStyle(main).overflow === 'scroll') {
4747
b2t.scrollableSelector = 'main';

elements/rh-back-to-top/demo/warnings.html

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)