mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
message_scroll: Use CSS transition for scroll to bottom button.
We are abandoning jQuery animation because it build up queue when there is continous switch in animation state. i.e When user goes ↑↓↑↓↑↓… at the bottom. Also added `aria-hidden` to `#scroll-to-bottom-button-container` so that this widget doesn't interfere with screen readers.
This commit is contained in:
@@ -172,7 +172,7 @@ export function make_compose_box_full_size() {
|
||||
|
||||
$(".collapse_composebox_button").show();
|
||||
$(".expand_composebox_button").hide();
|
||||
$("#scroll-to-bottom-button-container").hide();
|
||||
$("#scroll-to-bottom-button-container").removeClass("show");
|
||||
$("#compose-textarea").trigger("focus");
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ export function hide_scroll_to_bottom() {
|
||||
if (message_viewport.bottom_message_visible() || message_lists.current.empty()) {
|
||||
// If last message is visible, just hide the
|
||||
// scroll to bottom button.
|
||||
$show_scroll_to_bottom_button.fadeOut(500);
|
||||
$show_scroll_to_bottom_button.removeClass("show");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export function hide_scroll_to_bottom() {
|
||||
!narrow_state.narrowed_by_topic_reply() &&
|
||||
!$show_scroll_to_bottom_button.get(0).matches(":hover")
|
||||
) {
|
||||
$show_scroll_to_bottom_button.fadeOut(500);
|
||||
$show_scroll_to_bottom_button.removeClass("show");
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ export function show_scroll_to_bottom_button() {
|
||||
}
|
||||
|
||||
clearTimeout(hide_scroll_to_bottom_timer);
|
||||
$("#scroll-to-bottom-button-container").fadeIn(500);
|
||||
$("#scroll-to-bottom-button-container").addClass("show");
|
||||
}
|
||||
|
||||
$(document).on("keydown", (e) => {
|
||||
@@ -172,7 +172,7 @@ $(document).on("keydown", (e) => {
|
||||
|
||||
// Hide scroll to bottom button on any keypress.
|
||||
// Keyboard users are very less likely to use this button.
|
||||
$("#scroll-to-bottom-button-container").fadeOut(500);
|
||||
$("#scroll-to-bottom-button-container").removeClass("show");
|
||||
});
|
||||
|
||||
export function is_actively_scrolling() {
|
||||
|
||||
@@ -2976,11 +2976,18 @@ div.topic_edit_spinner .loading_indicator_spinner {
|
||||
}
|
||||
|
||||
#scroll-to-bottom-button-container {
|
||||
display: none;
|
||||
z-index: 3;
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: 41px;
|
||||
right: 0;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: visibility 500ms, opacity 500ms ease-in-out;
|
||||
|
||||
&.show {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#scroll-to-bottom-button-clickable-area {
|
||||
width: 60px;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
helps us align it at various screens sizes with
|
||||
minimal css and no JS. We keep it `position: absolute` to prevent
|
||||
it changing compose box layout in any way. --}}
|
||||
<div id="scroll-to-bottom-button-container">
|
||||
<div id="scroll-to-bottom-button-container" aria-hidden="true">
|
||||
<div id="scroll-to-bottom-button-clickable-area" data-tooltip-template-id="scroll-to-bottom-button-tooltip">
|
||||
<div id="scroll-to-bottom-button">
|
||||
<i class="fa fa-chevron-down"></i>
|
||||
|
||||
Reference in New Issue
Block a user