Create Label component #824
Labels
ready
Ready for implementation
type: enhancement
New feature or request
work: frontend
Related to frontend code in the mathesar_ui directory
Milestone
Problem
We don't have a great way to associate form labels with our input components.
Nesting them like this
will work but the svelte a11y linter complains.
Also W3C says:
Proposed solution
Create a utility function
It will return a string containing an auto-incrementing intger each time the function is called.
Then we can use that function within components to generate unique id values to use for form inputs.
Create a
Label
componentIf it recieves a
for
prop, it uses that on the DOM element.Otherwise, it uses a value from
getAppWideUniqueId()
and also passes that value down through context using a key of'formInputId'
so that nested form input components can read that context value.Modify input components to work with the
Label
component.'formInputId'
context value they should use that for theirid
, (unles passed anid
through props).The text was updated successfully, but these errors were encountered: