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

text-transform: lowercase; not allowing pattern validation #35

Closed
JZL opened this issue Nov 1, 2024 · 3 comments
Closed

text-transform: lowercase; not allowing pattern validation #35

JZL opened this issue Nov 1, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JZL
Copy link

JZL commented Nov 1, 2024

Describe the bug
Hi,

I really enjoy this service! It fit my exact use-case of personal-grade short url expansion and has already come in handy many times to make adhoc short urls (no more fighting taken bitly urls)

The short url only allows lower case letters but if you type capital letters (on purpose or b/c mobile keyboards automatically capitalize the first letter) then $('#shortUrl').value still has the full capital letters. This doesn't allow the html pattern="[a-z0-9\-_]+" to pass, making it impossible to submit. But because of

form input[name="shortUrl"] {
    text-transform: lowercase;
}

it's shown to the user as lowercase.

I don't know what the easiest way to fix this is, maybe trigger onchange events which has javascript lowercase the inputs. Or not have the CSS so the user can fix themselves.

How to reproduce

Put capital letters in shorturl field

@JZL JZL added the bug Something isn't working label Nov 1, 2024
@SinTan1729
Copy link
Owner

SinTan1729 commented Nov 3, 2024

Hi @JZL. Thanks for the bug report. I chose to disable the CSS changing to lowercase. This will give more uniform behavior across all unsupported characters.

Please test if this fixes your issue, and let me know. The test build is available at the docker image tag chhoto-url:dev. Feel free to reopen if you're still facing it.

@JZL
Copy link
Author

JZL commented Nov 7, 2024

Hi,

Cool that's perfect thanks for the prompt response! This works so it's clear what to fix, but could you also add autocapitalize="off" to the input, just to make it uncapitalized automatically on mobile? (tested myself, works)

Really enjoy using, sorry for the nit

@SinTan1729
Copy link
Owner

SinTan1729 commented Nov 7, 2024

@JZL Thanks for the suggestion. I can do that. I'm not a web dev (not a profesional dev at all, lol), so the suggestions are really helpful.

Edit: Added in f772475.

minoplhy pushed a commit to minoplhy/chhoto-url that referenced this issue Nov 23, 2024
This makes the behavior more uniform across different banned characters.
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