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

Create TextField component #2868

Merged
merged 21 commits into from
Aug 4, 2022
Merged

Create TextField component #2868

merged 21 commits into from
Aug 4, 2022

Conversation

marcoambrosini
Copy link
Contributor

@marcoambrosini marcoambrosini commented Jul 21, 2022

fixes #2866

  • Optional clear button
  • Placeholder
  • Optional icon in front? (Do we still do this, or is it only the registration app?)
  • Enforce a11y with a label outside of the view port
  • Announce valid input when the checkmark is shown
Screen.Recording.2022-07-27.at.11.44.52.mov

@marcoambrosini marcoambrosini changed the title Initialize TextField component Create TextField component Jul 21, 2022
@nickvergessen

This comment was marked as outdated.

@AndyScherzinger AndyScherzinger added the accessibility Making sure we design for the widest range of people possible, including those who have disabilities label Jul 21, 2022
@nickvergessen

This comment was marked as resolved.

@marcoambrosini marcoambrosini self-assigned this Jul 26, 2022
@marcoambrosini marcoambrosini force-pushed the feature/2866/text-field branch 5 times, most recently from 2c0461e to 7de9b5f Compare July 27, 2022 09:42
@marcoambrosini marcoambrosini marked this pull request as ready for review July 27, 2022 09:45
@CarlSchwan
Copy link
Contributor

CarlSchwan commented Jul 27, 2022

It looks really good, some points:

  • I guess a height of 44px would be better: this would pass the AAA WGAC checks and also allow to put of a and a in the same row and make then aligned
  • It should be possible to change the type attribute of the field to support number, tel, email, search ...
  • Make it possible to have a label inside the viewport and visible
  • Expose some props from input: disabled, max, min, required, minlength, maxlength,readonly, autocomplete, autofocus, ...
  • It would be good to have a PasswordField equivalent as a replacement for https://github.com/nextcloud/strengthify but probably best to add it in another separate PR

@marcoambrosini
Copy link
Contributor Author

I guess a height of 44px would be better: this would pass the AAA WGAC checks and also allow to put of a and a in the same row and make then aligned

I think that that would be too big for most purposes. I already made it slightly bigger than what we currently have. Also we're aiming at WCAG level 2 for most of our UI elements.

It should be possible to change the type attribute of the field to support number, tel, email, search ...

I would do this in separate components in order to have smaller and easier to maintain components. Once we have them we can create a "meta" inputVue component that receives the type prop, bind the attributes and forward the listeners so that it effectively becomes transparent.

Make it possible to have a label inside the viewport and visible

Sounds good :)

Expose some props from input: disabled, max, min, required, minlength, maxlength,readonly, autocomplete, autofocus, ...

These are already bound because all the attrs are inherited by the inner html <input /> element. I will add this to the docs though.

It would be good to have a PasswordField equivalent as a replacement for https://github.com/nextcloud/strengthify but probably best to add it in another separate PR

Sounds good :)

@marcoambrosini
Copy link
Contributor Author

Update: visible label option and added docs about attribute inheritance

Screenshot 2022-07-27 at 16 14 07

webpack.dev.js Outdated Show resolved Hide resolved
@nickvergessen nickvergessen added 2. developing Work in progress component Component discussion and/or suggestion labels Jul 28, 2022
@CarlSchwan
Copy link
Contributor

Update: visible label option and added docs about attribute inheritance

Screenshot 2022-07-27 at 16 14 07

hmm actually I would prefer if the API user could do something like this:

<div class="row">
   <label for="$ref.myField.id">My label</label>
   <TextField ref="myField" :label-outside="true"></TextField>
</div>

For example, this could be helpful in the personal settings page since we want to have our own label with a button next to it.

@marcoambrosini
Copy link
Contributor Author

marcoambrosini commented Jul 28, 2022

What about adding this label icon from within the textfield component, as a slot for example?
I think it's a good idea to foresee the main patterns in the component design and stick to those. @jancborchardt and @nimishavijay do you have a clear picture of how many variants of this we have?

@CarlSchwan
Copy link
Contributor

What about adding this label icon from within the textfield component, as a slot for example? I think it's a good idea to foresee the main patterns in the component design and stick to those. @jancborchardt and @nimishavijay do you have a clear picture of how many variants of this we have?

That would make sense and I would be happy with that too:

What I see as patterns are:

personal page

image

  • A label outside on top with one or two actions
  • an additional aria-describeby description at the bottom
  • an optional action inside

theming section

image

  • label and text field are side by side

inline textfield

  • placeholder text instead of a label
  • Should be avoided when possible and in particular when there is multiple text fields next to each others

image

@marcoambrosini
Copy link
Contributor Author

Copy link
Contributor

@CarlSchwan CarlSchwan left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

src/components/TextField/TextField.vue Outdated Show resolved Hide resolved
Copy link
Contributor

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

In case of passwords the clear button should be replaced with an Eye-con to show the password instead of ***** ?
Or not part of v1 of the component?

marcoambrosini and others added 8 commits August 2, 2022 08:39
Co-authored-by: Carl Schwan <carl@carlschwan.eu>
Signed-off-by: Marco <marcoambrosini@icloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Marco <marcoambrosini@icloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Marco <marcoambrosini@icloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Marco <marcoambrosini@icloud.com>
Signed-off-by: Marco Ambrosini <marcoambrosini@icloud.com>
Abstracts some logic into a more general purpose InputVue
component and build the TextField component on top of that.

Signed-off-by: Marco Ambrosini <marcoambrosini@icloud.com>
Signed-off-by: Marco Ambrosini <marcoambrosini@icloud.com>
Signed-off-by: Marco Ambrosini <marcoambrosini@icloud.com>
@marcoambrosini
Copy link
Contributor Author

/backport to stable5

src/components/TextField/TextField.vue Outdated Show resolved Hide resolved
src/components/index.js Outdated Show resolved Hide resolved
src/components/TextField/TextField.vue Outdated Show resolved Hide resolved
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Marco <marcoambrosini@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews accessibility Making sure we design for the widest range of people possible, including those who have disabilities component Component discussion and/or suggestion enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic reusable and accessible text field
5 participants