stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

bug: A horizontal scroll bar appears with long white space before the text

Open vihan85 opened this issue 1 year ago • 3 comments

Describe the bug

A horizontal scroll bar appears with long white space before the text

To Reproduce

Steps to reproduce the behavior:

  1. Go to: input
  2. type:
                                                                                                                                           text

Expected behavior

Trim white space

Screenshots

image

If applicable, add screenshots to help explain your problem.

Package version

  • stream-chat-react: v12.2.2
  • stream-chat-css:
  • stream-chat-js: v8.40.9

vihan85 avatar Oct 21 '24 10:10 vihan85

hey @vihan85 , thank you for the report. Is this an issue for the UI of demo application?

MartinCupela avatar Oct 21 '24 11:10 MartinCupela

Hi @MartinCupela, this issue occur on demo, I founded it on v11.23.6

minhth1529 avatar Oct 21 '24 11:10 minhth1529

hey @vihan85 , thank you for the report. Is this an issue for the UI of demo application? @MartinCupela yes, I found it on your demo.

vihan85 avatar Oct 23 '24 10:10 vihan85

Hi @MartinCupela this issue confirmed?

minhth1529 avatar Nov 14 '24 10:11 minhth1529

So the issue description confused me, as I was typing characters and spaces, but the actual thing to type is not shown correctly by the Github markdown parser. After setting the issue description to edit mode I have seen the below:

image

But if you take a look at how GH parses the markdown, it is the same as the message. I cannot therefore consider this a bug

image

MartinCupela avatar Nov 14 '24 10:11 MartinCupela

@MartinCupela it just show example, you can test that on you demo page

minhth1529 avatar Nov 14 '24 10:11 minhth1529

Yes, but it behaves as expected. See how it is rendered in this issue description

MartinCupela avatar Nov 14 '24 10:11 MartinCupela

You are quoting something, so the white spaces will not be trimmed

MartinCupela avatar Nov 14 '24 10:11 MartinCupela

I just typing: test. do not quote

minhth1529 avatar Nov 14 '24 11:11 minhth1529

Quoting in markdown is putting character > at the beginning of the line. That is what your issue description contains. Your last message is confusing.

MartinCupela avatar Nov 14 '24 11:11 MartinCupela

oh That wasn't my intention, I just wanted it to appear similar to the demo

https://github.com/user-attachments/assets/e861cbb4-7777-4005-bde5-d3b037940b5f

minhth1529 avatar Nov 14 '24 14:11 minhth1529

                                                                                                                                                                                                                                 test

The same thing happens in GitHub as you can see above in this message

MartinCupela avatar Nov 15 '24 08:11 MartinCupela

This is not a bug

MartinCupela avatar Nov 15 '24 08:11 MartinCupela

Hi @MartinCupela

You can watch the video below.

Why does a horizontal scroll bar appear instead of a line break?

Can you support line breaks like when entering a consecutive string that doesn't contain spaces?

https://github.com/user-attachments/assets/3960306f-126e-47f2-96fe-c0dc76d6fca4

vihan85 avatar Nov 15 '24 09:11 vihan85

Hey @vihan85 , the whitespace is not trimmed, because that is how MD is interpreted by the parser. It is by design. If you would like to change the behavior, I encourage you to provide your custom remark plugins. The guide is available here:

https://getstream.io/chat/docs/sdk/react/components/message-components/render-text/#custom-remark-and-rehype-plugins

You can take an inspiration from an existing plugin in the SDK:

https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/renderText/remarkPlugins/keepLineBreaksPlugin.ts

MartinCupela avatar Nov 15 '24 10:11 MartinCupela