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

Accessibility: Textfields are missing Labels #29

Closed
schellmax opened this issue Nov 17, 2020 · 3 comments
Closed

Accessibility: Textfields are missing Labels #29

schellmax opened this issue Nov 17, 2020 · 3 comments

Comments

@schellmax
Copy link

As mentioned in the docs at https://material.balmjs.com/#/data-input/textfield Textfield labels are passed through the default slot:

<ui-textfield>Label Text</ui-textfield>

and end up in the rendered HTML wrapped in a 'span' tag:

<span class="mdc-floating-label">Label Text</span>

In the original Material Design Component at https://material-components.github.io/material-components-web-catalog/#/component/text-field the appropriate 'label' element is used instead:

<label for="text-field-hero-input" class="mdc-floating-label">Name</label>

There is also a 'label' prop mentioned in the docs, but it seems not to be used by the component.

Label elements are critical for accessibility and should therefore be used for every form input. Balm UI already uses label elements e.g. for checkbox components; usage in Textfields would be highly appreciated.

@elf-mouse
Copy link
Member

Thanks @schellmax ,

When BalmUI is 6.x, I use <label> tag for floating label, then modify it to <span> tag according to the official document.

I also think it is better to use <label>, and I will improve it as soon as possible :)

elf-mouse added a commit that referenced this issue Nov 20, 2020
elf-mouse added a commit that referenced this issue Nov 20, 2020
@elf-mouse
Copy link
Member

Hi @schellmax ,

It's improved.

  • balm-ui@8.7.3 for vue2
  • balm-ui@9.1.0 for vue3

Thanks again :)

@schellmax
Copy link
Author

nice!

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

No branches or pull requests

2 participants