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

Characters are slightly chipped when inputting a small number of double-byte characters #232

Open
yasuking0304 opened this issue Oct 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@yasuking0304
Copy link

The problem

Characters are slightly chipped when inputting a small number of double-byte characters.

Release version

Latest

Operating system

Windows
Chome
Windows
Edge(Chomium)
Windows
Firefox
MacOS
Safari
MacOS
Chome
iPadOS
Safari
iPhone
Safari
Android
Chome
Android
Samsung Beower(Chromium)
NG NG NG No Problem NG No Problem No Problem NG NG

Steps to reproduce the behavior

Enter a double-byte character (e.g., "あ") in the search input box.

Log files

No response

Screenshots

Window Edge, Firefox and Android Chrome(Remote debuggiing)
WS000054

Additional context

↓It is calculated in the updateSearchBoxWidth function, but it is slightly narrower
https://github.com/xicri/genshin-dictionary/blob/main/components/elastic-searchbox.vue#L40-L46

    el.style.width = `${textLength * 1.05}em`;

A slight increase to 1.05 is fine.
However, I feel that it is okay to just remove the updateSearchBoxWidth function and set width: 100% in css

https://github.com/xicri/genshin-dictionary/blob/main/components/word-list-search.vue#L216-L218

  &__input {
    flex-shrink: 0;
    width: 100%;  ← add
  }
@xicri
Copy link
Owner

xicri commented Oct 14, 2024

Thanks, this is a bug that I couldn't fix when I implement this.
I will try your solution to fix this.

@xicri
Copy link
Owner

xicri commented Dec 6, 2024

I tried your solutions today, but I reminded that I tried them when I implemented this search box and both solutions didn't work as expected. I tried again today, and I confirmed they didn't work.

Additional context

↓It is calculated in the updateSearchBoxWidth function, but it is slightly narrower
https://github.com/xicri/genshin-dictionary/blob/main/components/elastic-searchbox.vue#L40-L46

    el.style.width = `${textLength * 1.05}em`;

A slight increase to 1.05 is fine.

With this solution, the width of <input> element gets too long when you enter long text. (e.g. "らいでんしょうぐんにてんせいしたら、てんかむてきになった")

However, I feel that it is okay to just remove the updateSearchBoxWidth function and set width: 100% in css
https://github.com/xicri/genshin-dictionary/blob/main/components/word-list-search.vue#L216-L218

  &__input {
    flex-shrink: 0;
    width: 100%;  ← add
  }

This solution also cause a scrolling issue when you add a long text. Tags and the query text are separatedly scroll.

(Sorry, these explanations are probably hard to understand. I will add more details if I have time and motivation... 🙏)


Currently, I'm rewriting the search input with contenteditable, but the progress is not good.
I heard an opinion that contenteditable is too complex just for adding rich components like tags, so I'm wondering if I should consider different approach without contenteditable.

I also considered to use a text input component library to allow adding something like the tags, but I have not found such library yet.
Let me know if you find such a library. Unmaintained or non-Vue components may help me too.

@xicri xicri self-assigned this Dec 8, 2024
@xicri xicri added the bug Something isn't working label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants