Autocomplete experimental messages option, no results
Asked Answered
S

2

3

I moved to jQuery UI 1.9 and have some problems with Autocomplete control. As written here they added option called messages that actually shows "No results" or results count information under the control. The problem that I can't any info about its behaviour find in the manuals.

How can I disable that option? Thank you

Saintly answered 8/11, 2012 at 5:52 Comment(7)
> If you're interested in the messages option, we encourage you to just read the source; the relevant code is at the very bottom of the autocomplete plugin and is only a few lines.Unparalleled
Yes, I saw that. But why there are no any information in API documentation? Or they mean If I don't need such feature I should to remove it from source code?Saintly
may be set option to something... that experimental feature, so it not documentedUnparalleled
really strange.. the final release and there are some undocumented options that are enabled by default..Saintly
they do many strange thing, main site is worse now than it was, early we had api documentation in demos, now notUnparalleled
So I just removed that code from sources.Saintly
WARNING: You shouldn't disable or remove with accessibility in name unless you understand that code completely and you know why you want to remove it. And I doubt this was the case. The message would be normally invisible to you if you also updated the stylesheet for the plugin. But it helps a lot to disabled users. Please do not remove this message. Use the same styling for the .ui-helper-hidden-accessible class as e.g.Bootstrap uses for .sr-only instead.Mays
A
11

Indeed not in the API documentation to the date of my answer... You can customize it this way:

  jQuery(...).autocomplete({
     messages : {
      noResults : 'No results found.',
      results : function(count) {
        return count + (count > 1 ? ' results' : ' result ') + ' found';
      }
    },
  });

NOTE: As commented by user actimel, customising is ok but do not hide it as it is part of the accessibility feature (blind users for example).

Ashwell answered 8/3, 2013 at 9:58 Comment(3)
I have extensivelly searched the jqueryui documentation and have found no refferences to this behavior/property. I am uttery blind?Whitsun
@Whitsun This is exactly what I say it is not documented (or at least was not when I posted this)Ashwell
You can customize the wording, but please do not try to disable or remvoe this accessibility feature. See my comment above.Mays
W
0

I have been digging around this a bit and found the following:

The message is part of jQuery UI accessibility functionality and is actually never supposed to be shown (visible) and only processed by screen-readers.

All your problems will go away if you use some of the jQuery UI stylesheet files that will hide these elements for you.

Whitsun answered 18/5, 2016 at 7:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.