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: reaction list is now scrollable #265

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Conversation

szuperaz
Copy link
Collaborator

🎯 Goal

This PR affects both Angular and React

This is an old bug, but we probably didn't notice it because it requires lots of reactions + very narrow device: but the reaction list above the message bubble could overflow.

🛠 Implementation details

This PR adds scrolling to the reaction list

A room for improvement: the reaction list could fill the whole width of the message list (see screenshots for visual explanation), this is currently not happening due to our CSS/HTML structure. Since this is not an easy fix, I'll leave this to our future selves.

🎨 UI Changes

Before:
Screenshot 2024-01-31 at 16 20 06

After:
Screenshot 2024-01-31 at 16 24 00

Make sure to test with both Angular and React (with both MessageList and VirtualizedMessageList components) SDKs

@oliverlaz oliverlaz self-requested a review January 31, 2024 15:56
Comment on lines +7 to +8
overflow-y: hidden;
overflow-x: auto;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make some accommodations for Windows, where scroll bars are always visible and occupy additional space?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, it looks a bit weird on Windows:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hm, I thought the scrollbar is only visible on windows if the content needs scrolling, but it looks like it's there even if there is no need for the scroll?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the definition for auto: Overflow content is clipped at the element's padding box, and overflow content can be scrolled into view. Unlike scroll, user agents display scroll bars only if the content is overflowing and hide scroll bars by default. If content fits inside the element's padding box, it looks the same as with visible, but still establishes a new block-formatting context. Desktop browsers provide scroll bars if content overflows. Does it work differently on windows?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did a test in windows and this is what I'm seeing:

UI when the reaction list fits the available space - no scrollbar here
2024-02-01 10 41 46

UI when the reaction list doesn't fit the screen - before the fix, overflow
2024-02-01 10 41 57

UI when the reaction list doesn't fit the screen - after the fix, scrollbar
2024-02-01 10 41 53

I agree that the scrollbar doesn't look nice, and if you have an easy to implement idea, I'm happy to change my fix. But if we don't have that, I think we should apply that fix, because it's better to have an ugly scrollbar, than an overflow.

Copy link
Contributor

@myandrienko myandrienko Feb 1, 2024

Choose a reason for hiding this comment

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

I agree that some scrollbar is better than no scrollbar :) In my screenshot there are actually additional reactions overflowing the container, that's why the scrollbar is visible.

Here's a usual way deal to deal with visible scrollbars:

/* On the reactions list container, hide all overflow */
.str-chat__message-reactions-container {
  overflow: hidden;
}

.str-chat__message-reactions {
  overflow-x: scroll;
  overflow-y: hidden;

  /* On the reactions list, give it some additional height.
     Normally the height is 28px, let's make it 56px */
  height: 56px;
  box-sizing: border-box;
  align-items: start; /* prevent reactions from stretching to 56px height */

  /* Hide all "additional" hide, including a scrollbar,
     in parent's overflow */
  margin-bottom: -28px;
}

This way even when the scrollbar is displayed, it stays hidden in its parent overflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed with @myandrienko to merge this as is, and then talk through with the team if we want the secondary fix, and implement it in a follow-up PR.

@szuperaz szuperaz force-pushed the reaction-list-scroll branch from d594872 to a616175 Compare February 1, 2024 12:23
@@ -4,6 +4,9 @@
display: flex;

.str-chat__message-reactions {
overflow-y: hidden;
overflow-x: auto;
scrollbar-width: none;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@szuperaz szuperaz merged commit de3ba43 into main Feb 1, 2024
@szuperaz szuperaz deleted the reaction-list-scroll branch February 1, 2024 12:50
github-actions bot pushed a commit that referenced this pull request Feb 1, 2024
## [4.6.1](v4.6.0...v4.6.1) (2024-02-01)

### Bug Fixes

* reaction list is now scrollable ([#265](#265)) ([de3ba43](de3ba43))
Copy link

github-actions bot commented Feb 1, 2024

🎉 This PR is included in version 4.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants