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

Add Spectrum Field Label Pattern #475

Closed
Westbrook opened this issue Feb 6, 2020 · 3 comments
Closed

Add Spectrum Field Label Pattern #475

Westbrook opened this issue Feb 6, 2020 · 3 comments
Labels
a11y Issues related to accessibility Component: Field Label help wanted Extra attention is needed missing components

Comments

@Westbrook
Copy link
Contributor

Expected Behaviour

https://opensource.adobe.com/spectrum-css/components/fieldlabel/ should be available in the library.

Actual Behaviour

Missing

The future

image

@Westbrook Westbrook added help wanted Extra attention is needed missing components a11y Issues related to accessibility Component: Form label labels Feb 6, 2020
@Westbrook
Copy link
Contributor Author

I think it will be good to structure this pattern in a way that is similar to this: https://stackblitz.com/edit/a11y-input?file=my-element.js Possibly a little more like a mixin than a base class, though I'm not sure. The reasoning here is that the label and the input element need to exist in the same DOM tree in order to be attached in an accessible manner. This means that you can't use a <sp-label>Input Label</sp-label><sp-textfield></sp-textfield> style pattern as the subsequent label and input would exist in separate DOM trees.

@Westbrook
Copy link
Contributor Author

I'm looking into a new version of this that leverages the idea that we move form elements into the light DOM of their containing elements, and then resolve them in scope with JS and dynamically associate those form elements with an <sp-field-label> element. It's currently looking promising, but I need to expand the pattern beyond just <sp-textfield> form elements to ensure that this is something that can be recommended as a library wide solutions for the need to be able to label form elements.

@Westbrook
Copy link
Contributor Author

Released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Issues related to accessibility Component: Field Label help wanted Extra attention is needed missing components
Projects
None yet
Development

No branches or pull requests

1 participant