i-like-robots/react-tags

Allow inputAttributes to override existing attributes

Herdismaria opened this issue · 3 comments

Describe the solution you'd like

We can already add attributes to the input via the inputAttributes props. However it would be nice if we could override all/some of the existing attributes. For example the aria-label. Now it uses the placeholder but sometimes the placeholder is just a hint and not clear enough for users using screen readers.

A clear and concise description of what you want to happen.
I want to be able to override the aria-label.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

You've raised an interesting point @Herdismaria - placeholders serve a different purpose to labels and are not equivelent. Perhaps adding a new label option (which could also output a <label> element?) would be useful addition. I think I'd rather introduce an explicit option than allowing anybody to trip themselves up by changing an internal detail. What do you think?

Label could work and would be a nice addition. However some use cases don't involve a label so it would need to be optional and allow some custom styling, I guess.
The simples solution to the aria-label problem would probably be to just add a prop for it, make it optional and default to the label/placeholder?

Sounds good to me. Are you happy to submit a PR for this?