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

[tags] Fix wrong tag input width for CJK characters #4094

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

YUCLing
Copy link
Contributor

@YUCLing YUCLing commented Oct 25, 2024

Fixes #0000

Changes proposed in this pull request:
Add a text measurement utility function in TagSelectionModal that is based on canvas's measureText. And make input width prefer this instead of ch unit.

The reason of ch unit doesn't work:

Equal to the used advance measure of the “0” (ZERO, U+0030) glyph found in the font used to render it. (The advance measure of a glyph is its advance width or height, whichever is in the inline axis of the element.)

Reviewers should focus on:

Do you think should we make the measurement utility a globally available function?

Screenshot

Before
image

After
image

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

@YUCLing YUCLing requested a review from a team as a code owner October 25, 2024 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant