question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"disabled" options are still used by autocomplete

See original GitHub issue

If I have a select field like this:

<select name="test" id="test">
  <option value="">Select...</option>
  <option value="a">A</option>
  <option value="b" disabled>B</option>
  <option value="c">C</option>
</select>

And enable autocomplete like this:

<script>
  accessibleAutocomplete.enhanceSelectElement({
    defaultValue: '',
    selectElement: document.querySelector('#test')
  });
</script>

Then if I type “B” in the autocomplete input field, B is chosen. I would expect it to not be available.

(I can imagine there might be good reasons why gov.uk doesn’t use disabled – maybe it’s poor accessibility? Some other reason? In which case I understand why this doesn’t support the option 😃 But as an outsider using this otherwise excellent tool, this was unexpected behaviour.)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hannalaaksocommented, Mar 9, 2020

@philgyford We’re prioritising bug fixes over new feature development for the accessible autocomplete right now so we won’t be able to work on this at the moment. But thanks for flagging it, it’s good to have it recorded 👍

0reactions
edwardhorsfordcommented, Feb 1, 2020

@philgyford I designed the original Accessible Autocomplete together with @tvararu.

I don’t think we explicitly didn’t support it so much as not building for it as it wasn’t a priority or used by GOV.UK. In other cases where services can’t control the markup we’ve provided some disabled styles -but in this case we’d have expected the service must have control of the markup so can avoid disabled, etc.

The sorts of selects you get in government services don’t generally have need for disabled items (clothing sizes out of stock, etc)

@nickcolley I assume the preferred solution would be for the disabled options to still be shown, but somehow indicated as not selectable.

I can see good reasons why someone might want a disabled option - though it might take some work - as you’d need to work out how to communicate to this to AT, and handle focus keyboard movement through the options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material-UI Autocomplete disable options present in array
Let's say that I have an array that I am dynamically generating of timeSlots that I would like to disable, timeSlotsArr , how...
Read more >
jQuery UI Autocomplete disabled Option - GeeksforGeeks
jQuery UI Autocomplete disabled option when set to true, will disable the menu. Default value is False. Syntax:.
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested options. The widget is useful for setting the value of...
Read more >
Hide autocomplete options panel on disabled or add ... - GitHub
Hide the options panel of autocomplete if the input element goes disabled. Or add a method to hide the panel in an official...
Read more >
Disabled Items - AutoComplete - Kendo UI for Angular - Telerik
The AutoComplete allows you to disable some of its options and prevent the user from interacting with them. The following example demonstrates how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found