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

Feature: Add visible inner label for NcInputField on border #4394

Merged
merged 2 commits into from Aug 25, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Aug 2, 2023

☑️ Resolves

Alternative to #4287 as requested by @marcoambrosini

🖼️ Screenshots

vokoscreenNG-2023-08-02_17-42-57.mp4

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable

@susnux susnux added 3. to review Waiting for reviews discussion Need advices, opinions or ideas on this topic feature: input-field Covering the InputField, TextField, ... labels Aug 2, 2023
@susnux susnux changed the title Feat/ncinput always shown label alt Alternative: Always shown label on NcInputFields Aug 2, 2023
Copy link
Contributor

@marcoambrosini marcoambrosini left a comment

Choose a reason for hiding this comment

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

Looks very good and the text has more space around which makes it more readable. All the while using less height. It's true that the icon is not a problem with the other approach either.
I would probably avoid moving the label left in the transition when there's a leading icon. What do you think @susnux?

@dartcafe
Copy link
Contributor

dartcafe commented Aug 4, 2023

I like it, but the initial state looks like the field already has a content, although it seems to be a placeholder/the label. I fear this could mislead users.

@susnux susnux requested a review from szaimen August 8, 2023 13:22
@szaimen
Copy link
Contributor

szaimen commented Aug 9, 2023

I would probably avoid moving the label left in the transition when there's a leading icon. What do you think @susnux?

I agree. Otherwise looks good to me :)

@susnux
Copy link
Contributor Author

susnux commented Aug 11, 2023

Thank you for your feedback, so far I would change it to:

  1. Do not move label horizontal
  2. Make label --color-text-maxcontrast so it does not look like content

@szaimen
Copy link
Contributor

szaimen commented Aug 11, 2023

  • Do not move label horizontal
  • Make label --color-text-maxcontrast so it does not look like content

Sounds good to me 👍

@susnux
Copy link
Contributor Author

susnux commented Aug 18, 2023

@szaimen @dartcafe @marcoambrosini I fixed the label color and the horizontal shift, it looks like this now:

input.mp4

Copy link
Contributor

@szaimen szaimen left a comment

Choose a reason for hiding this comment

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

Looks great! :)
But didnt review the code

@nimishavijay
Copy link

Looks good! :)
I would suggest 2 very small changes:

  • for the text fields without an icon there is still a horizontal shift of the label when it is focused, so if we do margin-inline: 6px 0; when focused and margin-inline: 10px 0; when unfocused this shift is gone
  • for success and error variants, the color of the label when focused should be either --color-success-text or --color-error-text, currently it's the primary color for everything

With those fixes it would look like this:

Recording.2023-08-18.160931.mp4

Also, on my system there is some text getting cut off, and it changes according to the zoom level.

1280x720 at 100%
image

1280x720 at 80%
image

ccing @marcoambrosini as well :)

@susnux

This comment was marked as outdated.

@susnux susnux force-pushed the feat/ncinput-always-shown-label-alt branch from 277dc6f to cfd6e06 Compare August 18, 2023 14:59
@JuliaKirschenheuter
Copy link
Contributor

wow, that is great! Thanks a lot!

Copy link
Contributor

@JuliaKirschenheuter JuliaKirschenheuter left a comment

Choose a reason for hiding this comment

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

Looks great! Could you please increase a contrast of labels on not focused state? see nextcloud/server#36948 If contrasts are enough - just ignore it ;)

@susnux susnux force-pushed the feat/ncinput-always-shown-label-alt branch from cfd6e06 to 0d17b9f Compare August 18, 2023 16:52
@susnux
Copy link
Contributor Author

susnux commented Aug 18, 2023

@nimishavijay

* [ ]  for the text fields without an icon there is still a horizontal shift of the label when it is focused, so if we do `margin-inline: 6px 0;` when focused and `margin-inline: 10px 0;` when unfocused this shift is gone

Fixed that, the label is now start-aligned with the input and with the focused label (So the first letter is always on the same x position)

* [ ]  for success and error variants, the color of the label when focused should be either `--color-success-text` or `--color-error-text`, currently it's the primary color for everything

Was a regression of the last commit, fixed again.

On question for me is: Should the text stay that color? Currently it will be max-contrast when not focused to have a visual hover / focus state (as the border color can not change).

Also, on my system there is some text getting cut off, and it changes according to the zoom level.

Would you mind try again? I fixed the label height.

@susnux
Copy link
Contributor Author

susnux commented Aug 18, 2023

@JuliaKirschenheuter

Could you please increase a contrast of labels on not focused state?

The contrast is currently 4.54 : 1
So it should fulfill the requirement :)

@nimishavijay
Copy link

Would you mind try again? I fixed the label height.

Works now 👍

Should the text stay that color? Currently it will be max-contrast when not focused to have a visual hover / focus state (as the border color can not change).

That's a good point. I would say that it could just stay --color-text-maxcontrast as the mouse cursor is changing to indicate hover feedback anyway. It would be inconsistent to change the color only for success and error variants. Since these variants are used not so often, it is okay to just have the mouse cursor change as the hover feedback :)

The inner label is now visible, to disable any label set `label-outside` to true, `label-visible` property is removed.
The label is shown instead of the placeholder if the input is empty and not focussed, when focussed the label is moved up and scaled but always shown.
Make label color max-contrast so it does not look like content and remove horizontal label movement

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…nges with always shown labels

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the feat/ncinput-always-shown-label-alt branch from 0d17b9f to 916ba53 Compare August 23, 2023 19:53
@susnux
Copy link
Contributor Author

susnux commented Aug 23, 2023

Squashed the fixup commits

@susnux susnux added enhancement New feature or request 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews discussion Need advices, opinions or ideas on this topic labels Aug 23, 2023
@susnux susnux added this to the 8.0.0 milestone Aug 23, 2023
@susnux susnux changed the title Alternative: Always shown label on NcInputFields Feature: Add visible inner label for NcInputField on border Aug 23, 2023
@susnux susnux merged commit e03e6c8 into master Aug 25, 2023
17 checks passed
@susnux susnux deleted the feat/ncinput-always-shown-label-alt branch August 25, 2023 08:43
juliushaertl added a commit that referenced this pull request Aug 30, 2023
…ield

In previous versions the label was shown above the input which gives the
text more space which might be better than the inline label from
#4394 in some
scenarios.

This is a breaking change as it renames the previous labelVisible
property to a labelOutside property. The label should always be visible
with the new NcInputField, however we can optionally decide to have the
label outside.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
juliushaertl added a commit that referenced this pull request Aug 30, 2023
…ield

In previous versions the label was shown above the input which gives the
text more space which might be better than the inline label from
#4394 in some
scenarios.

This is a breaking change as it renames the previous labelVisible
property to a labelOutside property. The label should always be visible
with the new NcInputField, however we can optionally decide to have the
label outside.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement New feature or request feature: input-field Covering the InputField, TextField, ...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants