Skip to content

Name length too long error fix #21668

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

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

Conversation

AniketSarkar26
Copy link

@AniketSarkar26 AniketSarkar26 commented Mar 8, 2025

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • [(/)] Bug Fix
  • Optimization
  • Documentation Update

Description

The maximum length for a name according to the backend is 100 characters. Though when editing the profile, the maximum length of the input field is 30.

Related Tickets & Documents

#21620

  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Semantic HTML implemented?
  • Keyboard operability supported?
  • Checked with axe DevTools and addressed Critical and Serious issues?
  • Color contrast tested?

For more info, check out the
Forem Accessibility Docs.

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

alt_text

@AniketSarkar26 AniketSarkar26 requested a review from a team as a code owner March 8, 2025 11:10
Copy link
Contributor

github-actions bot commented Mar 8, 2025

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

Copy link
Contributor

github-actions bot commented Mar 8, 2025

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
@mikeydorje
@AniketSarkar26
You can retrigger this bot by commenting recheck in this Pull Request

@mikeydorje mikeydorje force-pushed the aniketsarkar26/name_length_fix branch from 1613055 to f4e0357 Compare June 6, 2025 21:11
Copy link
Contributor

@mikeydorje mikeydorje left a comment

Choose a reason for hiding this comment

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

I wasn't able to reproduce this. It looks like the name and username fields are hardcoded with a 30-character limit, so it's not possible to type more and trigger the error.

I even installed and tested on Zen Browser, as noted in the issue, and the 30-character limit worked correctly there too.

My guess is this was either a one-off glitch or has since been fixed. I'd recommend closing this PR and the associated issue #21620

@mikeydorje
Copy link
Contributor

@kkrypt0nn Thanks for pushing back on this. Although I was unable to duplicate the error under normal user behaviour, as the maxlength is hardcoded to 30 characters in the profile edit partial, you are correct that there is a discrepancy, as the user model has the limit at 100. Your fix to update the UI to 100 is correct, as 30 characters is too short for some names.

However, in testing this change, I found that it introduces a design issue. I tested with various lengths, and although it's not a common case, it is possible for a long name without spaces to break the layout in the user dropdown menu. Most other areas I checked seem to handle this with truncation or line breaks already, but this one needs a fix.

A possible fix could be to target the <span> inside #user-profile-link-placeholder with a specific CSS rule like this:

#user-profile-link-placeholder .fw-medium {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@benhalpern, what do you think?

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.

2 participants