Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(back-to-top): demo visibility and logical properties #2133

Merged
merged 14 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-buckets-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-back-to-top>`: remove user-facing errors and warnings from missing attributes/values from the console
6 changes: 3 additions & 3 deletions elements/rh-back-to-top/demo/always-visible.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
main {
display: block;
scroll-behavior: smooth;
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
}
#bottom {
position: absolute;
bottom: 0;
inset-block-end: 0;
}
#nav {
height: calc(100dvh - var(--pf-demo-header-height, 4.375rem)); !important;
block-size: calc(100dvh - var(--pf-demo-header-height, 4.375rem)); !important;
}
</style>
10 changes: 5 additions & 5 deletions elements/rh-back-to-top/demo/color-context.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
main {
display: block;
scroll-behavior: smooth;
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
}

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

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

#bottom {
position: absolute;
bottom: 0;
inset-block-end: 0;
}

@media (prefers-reduced-motion: reduce) {
Expand All @@ -61,7 +61,7 @@
<script type="module">
/* add support for demo/fullscreen and dev server */
const b2t = document.querySelector('rh-back-to-top');
const main = document.querySelector('main');
const main = document.querySelector('main, [role="main"]');
// if main isn't scrollable use window
if (window.getComputedStyle(main).overflow === 'scroll') {
b2t.scrollableSelector = 'main';
Expand Down
10 changes: 5 additions & 5 deletions elements/rh-back-to-top/demo/no-slotted-text.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
main {
display: block;
scroll-behavior: smooth;
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
}

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

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

#bottom {
position: absolute;
bottom: 0;
inset-block-end: 0;
}

@media (prefers-reduced-motion: reduce) {
Expand All @@ -39,7 +39,7 @@
<script type="module">
/* add support for demo/fullscreen and dev server */
const b2t = document.querySelector('rh-back-to-top');
const main = document.querySelector('main');
const main = document.querySelector('main, [role="main"]');
// if main isn't scrollable use window
if (window.getComputedStyle(main).overflow === 'scroll') {
b2t.scrollableSelector = 'main';
Expand Down
48 changes: 0 additions & 48 deletions elements/rh-back-to-top/demo/on-a-scrollable-page.html

This file was deleted.

100 changes: 0 additions & 100 deletions elements/rh-back-to-top/demo/position-sticky.html

This file was deleted.

11 changes: 11 additions & 0 deletions elements/rh-back-to-top/demo/rh-back-to-top.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<div id="overflow">
<p>Scroll down to reveal the back to top element</p>
<rh-back-to-top href="#">Back to top</rh-back-to-top>
</div>

<script type="module">
import '@rhds/elements/rh-back-to-top/rh-back-to-top.js';
</script>

<style>
#overflow {
min-block-size: calc(100dvh + 401px);
}

p {
font-weight: bold;
}
</style>
10 changes: 5 additions & 5 deletions elements/rh-back-to-top/demo/scroll-distance.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
main {
display: block;
scroll-behavior: smooth;
max-height: calc(100dvh - var(--pf-demo-header-height)) !important;
max-block-size: calc(100dvh - var(--pf-demo-header-height)) !important;
}

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

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

#bottom {
position: absolute;
bottom: 0;
inset-block-end: 0;
}

@media (prefers-reduced-motion: reduce) {
Expand All @@ -41,7 +41,7 @@
<script type="module">
/* add support for demo/fullscreen and dev server */
const b2t = document.querySelector('rh-back-to-top');
const main = document.querySelector('main');
const main = document.querySelector('main, [role="main"]');
// if main isn't scrollable use window
if (window.getComputedStyle(main).overflow === 'scroll') {
b2t.scrollableSelector = 'main';
Expand Down
51 changes: 0 additions & 51 deletions elements/rh-back-to-top/demo/warnings.html

This file was deleted.

Loading
Loading