-
Notifications
You must be signed in to change notification settings - Fork 332
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
fix(standalone): use aria label from input #276
Conversation
This looks correct, but I will not have time to review this request until after the holidays. Could you describe which behaviour you are trying to fix? I thought there were already labels? |
I'm using places.js and I have this element
When I call |
@Haroenv A friendly reminder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, and good catch!
Autocomplete.js has an ariaLabel
option exposed (although it seems that it's not correctly forwarded, as you noticed). link
It would probably be better if your fix uses the options.ariaLabel and uses the input's aria-label
attribute as a fallback.
Something like that:
...
ariaLabel: options.ariaLabel || input.getAttribute('aria-label')
This would probably have a less surprising behaviour when calling autcomplete('#search-box', { ariaLabel: 'my-label', ... })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Can we have a release for this soon? :) |
I released 0.36.0 earlier today |
Summary
Use
aria-label
property from given input element on the new input element.Result
When using standalone version (with places.js for instance) the aria-label on the target input element will be forwarded to the input element created by autocomplete.js.