Skip to content

fix: uppercase Å looked like Ă in input fields#4301

Merged
unekinn merged 5 commits intomainfrom
fix/cutoff-uppercase-aa-in-input
Dec 15, 2025
Merged

fix: uppercase Å looked like Ă in input fields#4301
unekinn merged 5 commits intomainfrom
fix/cutoff-uppercase-aa-in-input

Conversation

@unekinn
Copy link
Contributor

@unekinn unekinn commented Dec 9, 2025

Summary

Fixes a bug in Input, Search, Suggestion, Textfield where uppercase Å was cut off at the top in Chrome and Safari, making it look like Ă

resolves #4293

Checks

@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2025

🦋 Changeset detected

Latest commit: 905a4bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@digdir/designsystemet-css Patch
@digdir/designsystemet-react Patch
@digdir/designsystemet Patch
@digdir/designsystemet-theme Patch
@digdir/designsystemet-types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

Preview deployments for this pull request:

storybook - 12. Dec 2025 - 14:46

@unekinn
Copy link
Contributor Author

unekinn commented Dec 9, 2025

For discussion

With this implementation, if downstream consumer has overridden --dsc-input-padding (or the new --dsc-input-padding-block) it will probably look different than before. Is there any point in trying to avoid this?

Let --PADDING_THRESHOLD be var(--dsc-input-size) / 2 - var(--dsc-input-border-width) (in size md this is 22px)

  • Before this PR: If --dsc-input-padding is overridden downstream with block padding <= --PADDING_THRESHOLD, the input height is unchanged. Above this, height will increase.
  • This PR currently: If --dsc-input-padding is overridden downstream, the height may be smaller than before (block padding < --PADDING_THRESHOLD) or larger

However, I could introduce css calculations to check this threshold in order to keep the old behavior, where --dsc-input-size essentially functions as a minimum height. Not sure if it's worth complicating the code, though.

EDIT: In the current iteration, any block padding (set with --dsc-input-padding or --dsc-input-padding-block) will affect the following as before: [type='button'], [type='radio'], [type='checkbox'], [type='color'], [type='file'], textarea, select. Other input types will have block padding overridden to ensure the height is exactly --dsc-input-size and Å is not cut off.

@unekinn unekinn force-pushed the fix/cutoff-uppercase-aa-in-input branch from 22adda4 to 0379c10 Compare December 9, 2025 16:28
field-sizing: content;
}
}
&:is([type='text'], [type='search'], [type='num'], [type='tel'], [type='url'], [type='password'], [type='month'], [type='week']) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
&:is([type='text'], [type='search'], [type='num'], [type='tel'], [type='url'], [type='password'], [type='month'], [type='week']) {
&:not(:read-only:not([readonly])) {

...will target all inputs that is writable, but exclude radio, checkbox and select :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I may be misunderstanding what you mean here, but if I try this selector it also messes up type="radio", type="checkbox", type="color" if they are readonly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Contributor

Choose a reason for hiding this comment

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

arg, right! so, :not([type="radio"], [type="checkbox"], [type="color"], select) might be easier then? :/ input - doing too many things since 1993 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is enough to not cause issues

:not([type='radio'], [type='checkbox'], [type='color'])

but it feels more correct with

:not([type='button'], [type='radio'], [type='checkbox'], [type='color'], [type='file'], [type='textarea'], select)

@oddvernes
Copy link
Collaborator

The only edge case i can think of with an unset height is when you have an Input inside a flex-container with a set height and no align-items set (stretch is default). Not sure how likely this scenario is though and obviously the donwstream developer can fix it 🤷‍♂️
bilde

@Barsnes
Copy link
Member

Barsnes commented Dec 12, 2025

The only edge case i can think of with an unset height is when you have an Input inside a flex-container with a set height and no align-items set (stretch is default). Not sure how likely this scenario is though and obviously the donwstream developer can fix it 🤷‍♂️ bilde

I'ts not an uncommon usecase, but it should be easy enough to fix 🤔
You usually set align-items as well

EDIT: Well actually, I am guessing most people use the input inside Field anyways

@unekinn unekinn force-pushed the fix/cutoff-uppercase-aa-in-input branch from 0379c10 to ee17ccd Compare December 12, 2025 12:11
@unekinn
Copy link
Contributor Author

unekinn commented Dec 12, 2025

The only edge case i can think of with an unset height is when you have an Input inside a flex-container with a set height and no align-items set (stretch is default). Not sure how likely this scenario is though and obviously the donwstream developer can fix it 🤷‍♂️

I'ts not an uncommon usecase, but it should be easy enough to fix 🤔 You usually set align-items as well

EDIT: Well actually, I am guessing most people use the input inside Field anyways

True, and e.g. when used with Textfield this is not an issue unless you specifically set the height of .ds-field-affixes with your own css. I think it's fair to have folks set align-items on the flex container if necessary.

field-sizing: content;
}
}
&:not([type='button'], [type='radio'], [type='checkbox'], [type='color'], [type='file'], [type='textarea'], select) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
&:not([type='button'], [type='radio'], [type='checkbox'], [type='color'], [type='file'], [type='textarea'], select) {
&:not([type='button'], [type='radio'], [type='checkbox'], [type='color'], [type='file'], textarea, select) {

<3 :)

@unekinn unekinn force-pushed the fix/cutoff-uppercase-aa-in-input branch from 2e868d1 to 905a4bb Compare December 12, 2025 13:43
@unekinn unekinn merged commit 7dff40d into main Dec 15, 2025
16 checks passed
@unekinn unekinn deleted the fix/cutoff-uppercase-aa-in-input branch December 15, 2025 08:53
@github-actions github-actions bot mentioned this pull request Dec 12, 2025
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.

Input: fix letter Å clipping

4 participants