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

Apply accessibility attributes to suggestion template #185

Merged
merged 2 commits into from
Nov 16, 2019

Conversation

dfrencham
Copy link
Contributor

When the suggestion template is customised, the accessibility related attributes are no longer applied.

This results in screen readers not reading the selected element. This behaviour has been observed in JAWS 18 running under Internet Explorer 11.

The Aria-activedescendant attribute is used to link the input text field to the current selection. I have updated dataset.js to apply the id (generated by guid()) in the event a user customises the template.

Example of user generated template:

templates: {
    suggestion: function (data) {
        if (data.isUserEntered) {
            return '<div style="font-weight:bold">Use entered address:<br/>' + data.searchPickListDescription + '</div>';
        }
        else {
            return '<div class="matching-address">' + data.searchPickListDescription + '</div>';
        }
    }
}

@jlbooker
Copy link
Contributor

👍 Thanks @dfrencham

@colinrotherham, Any chance you'd have time to review this?

@jlbooker jlbooker added this to the v1.2.0 milestone May 15, 2018
@colinrotherham
Copy link
Contributor

Hi @jlbooker, @dfrencham,

Sorry it's been a while since I contributed to this project. The change looks pretty good, but typeahead.js has got a good test suite. Can you add tests added for this change?

Without tests, there's nothing to stop this change (accidentally) being broken in future.

@dfrencham
Copy link
Contributor Author

Hi @colinrotherham,

No problem I'll add tests later today.

@colinrotherham
Copy link
Contributor

I must also add my attention's been elsewhere, the UK Government Digital Service accessible-autocomplete component has recently been tested by the Digital Accessibility Centre.

Testing has been carried out with JAWS, Dragon NaturallySpeaking, Zoomtext, VoiceOver, NVDA.

Blog posts here:

Initial launch
https://designnotes.blog.gov.uk/2017/04/20/were-building-an-autocomplete/

Follow up this week
https://accessibility.blog.gov.uk/2018/05/15/what-we-learned-from-getting-our-autocomplete-tested-for-accessibility/

Some great tips in there for this repo too. Keep up the good work.

//cc @edwardhorsford

@dfrencham
Copy link
Contributor Author

@colinrotherham I've added a couple of unit tests.

I've seen your gov.uk autocomplete - I've actually emailed the link to my co-workers a few months ago as a potential replacement auto complete component. Excellent work! 👍

We currently use the (old) twitter-autocomplete in our production environment. We have a lot of event handlers adding various aria roles and attributes to allow JAWS/NVDA compatibility.

Switching to this fork of that component solves some async issues around JAWS/IE, and lets me remove all the custom event handlers (as you are adding all the accessible markup).

For reference, we are using this component on some Australia government applications with user counts in the millions.

@colinrotherham
Copy link
Contributor

Thanks @dfrencham that's great. Always good to hear.

@jlbooker I'm not set up with Grunt anymore, but I'm happy if you say everything passes 👍

@dfrencham
Copy link
Contributor Author

Any updates on this? Thanks

@colinrotherham
Copy link
Contributor

Hi @dfrencham, I don't have permission to approve this merge without @jlbooker sorry.

Can you npm publish under a namespace for now so you can bundle it into your sites?

@dfrencham
Copy link
Contributor Author

I already have it deployed on our sites 👍

When it is merged, then I'll move our sites to use the main version. I'll just have to be patient and wait for @jlbooker to have some availability. Cheers.

mattywong pushed a commit to mattywong/typeahead.js that referenced this pull request Jan 30, 2019
@jlbooker jlbooker merged commit 5ad845f into corejavascript:master Nov 16, 2019
@jlbooker
Copy link
Contributor

Thanks! @dfrencham, and appreciate your patience. Sorry for the long delay!

@dfrencham dfrencham deleted the accessibility-template branch November 17, 2019 04:18
@dfrencham
Copy link
Contributor Author

@jlbooker Better late than never! Cheers mate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants