open-resume icon indicating copy to clipboard operation
open-resume copied to clipboard

Bullet list firefox issue

Open xitanggg opened this issue 1 year ago • 7 comments

Documenting a feedback

One thing I noticed was the really weird (I am on Firefox) : When I tried to enter text in the additional box and bullet points were activated it would create a bullet point after every space I pressed....

xitanggg avatar Jun 26 '23 00:06 xitanggg

Hey great tool. Can confirm I also have this issue on Firefox Desktop 114.0.2 (64-bit)

mahalel avatar Jun 26 '23 00:06 mahalel

Up!

In bullet point sections, after the first word and a space, every letter goes to a new bullet point:

image

It's fine in Chrome though.

datsudo avatar Jun 26 '23 05:06 datsudo

Apologize for this bug, I will prioritize fixing this issue early this week

xitanggg avatar Jun 26 '23 06:06 xitanggg

Please don't apologize, we appreciate your work and your time.

mahalel avatar Jun 26 '23 06:06 mahalel

Feels like there is some kind of counter issue? You can eventually get the text (full phrase) fit for the one bullet if you play around enough with spaces and backspace.

Nicceboy avatar Jun 26 '23 09:06 Nicceboy

Can confirm this happens on Safafi Version 16.5 (18615.2.9.11.4) as well.

williamtwild avatar Jun 26 '23 13:06 williamtwild

I am facing this issue as well. I just checked right now.

image

Just adding a space enters a new line, and then from then on, every keystroke creates a new line (or a new entry in the bullet list).

ritog avatar Jun 27 '23 14:06 ritog

Just got a chance to take a closer look at the issue. BulletListTextarea is the component to manage the descriptions input. It is essentially a content editable div and uses innerText to set what user enters. A weird thing about Firefox is that if it is at the end of the line and user presses space, innerText appends a new line character instead of appending a space as in other browser (Chrome, Edge).

It is not as a simple fix as I would have previously thought. I just created an issue with Firefox on https://github.com/webcompat/web-bugs/issues/124217 to learn more about why innerText behaves such a way 🤔

To reproduce this issue:

  1. Visit the codesandbox debug setup created https://codesandbox.io/s/contenteditable-innertext-debug-kf5psc?file=/src/index.js
  2. Open Console in codesandox
  3. Enter b in the textbox, observe it prints "ab"
  4. Enter space in the textbox, observe it prints "ab" follow by a new line (in Firefox) instead of "ab " (in Chrome, Edge)

xitanggg avatar Jun 29 '23 07:06 xitanggg

What happens using innerHTML?

williamtwild avatar Jun 29 '23 12:06 williamtwild

Thanks all for reporting this issue! I just created and released a fallback component BulletListTextareaFallback for Firefox and Safari as a workaround solution. Can anyone help test it on their end and confirm if it indeed solves the issue?

The fallback component should work fine most of the case. There is a small edgecase I notice where it would refocus to the end if you have say 2 bullet points, and you try to backspace/remove the second bullet point to combine it with the first one. Hopefully this isn't common to run into.

I initially created a custom BulletListTextarea component since I want the output to be an array of string type descriptions: sting [] given that is the input format consumed by the react pdf render to render the description list. I used innerText since it would be easier to serialize and deserialize things by splitting the string by new line. Using innerHTML might require more work to split by <div> <br> and we might go into the same problem, as I notice Firefox adds a <br> in innerHTML if user adds a space at the end of the line. image A lesson learned is that each browser handles innerText and innerHTML very differently, and it can be risky to rely on them.

xitanggg avatar Jul 02 '23 00:07 xitanggg

Seems to work fine now on Firefox and Safari . Thank you .

williamtwild avatar Jul 02 '23 16:07 williamtwild

Thanks @williamtwild for confirming! Closing this issue for now given that the fallback component seems to work fine.

xitanggg avatar Jul 03 '23 22:07 xitanggg