Skip to content

Commit

Permalink
place toast message at the top of the screen on mobile (#4796)
Browse files Browse the repository at this point in the history
  • Loading branch information
pngwn committed Jul 6, 2023
1 parent b8eb481 commit 7261157
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -35,6 +35,7 @@
- Fixes `gr.Dropdown` being cutoff at the bottom by [@abidlabs](https://github.com/abidlabs) in [PR 4691](https://github.com/gradio-app/gradio/pull/4691).
- Scroll top when clicking "View API" in spaces by [@pngwn](https://github.com/pngwn) in [PR 4714](https://github.com/gradio-app/gradio/pull/4714)
- Fix bug where `show_label` was hiding the entire component for `gr.Label` by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4713](https://github.com/gradio-app/gradio/pull/4713)
- Place toast messages at the top of the screen by [@pngwn](https://github.com/pngwn) in [PR 4796](https://github.com/gradio-app/gradio/pull/4796)

## Other Changes:

Expand Down
11 changes: 4 additions & 7 deletions js/app/src/components/StatusTracker/Toast.svelte
Expand Up @@ -11,8 +11,7 @@
function scroll_to_top(_messages: ToastMessage[]): void {
if (_messages.length > 0) {
if ("parentIFrame" in window) {
let is_large = window.matchMedia("(min-width: 640px)").matches;
window.parentIFrame?.scrollTo(0, is_large ? 0 : 999999);
window.parentIFrame?.scrollTo(0, 0);
}
}
}
Expand All @@ -30,9 +29,10 @@
.toast-wrap {
display: flex;
position: fixed;
top: var(--size-4);
right: var(--size-4);
bottom: var(--size-4);
flex-direction: column-reverse;
flex-direction: column;
align-items: end;
gap: var(--size-2);
z-index: var(--layer-top);
Expand All @@ -41,9 +41,6 @@
@media (--screen-sm) {
.toast-wrap {
top: var(--size-4);
bottom: unset;
flex-direction: column;
width: calc(var(--size-96) + var(--size-10));
}
}
Expand Down

1 comment on commit 7261157

@vercel
Copy link

@vercel vercel bot commented on 7261157 Jul 6, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.