Problem/Motivation

The maxResults feature is not needed for BC with jQuery UI Autocomplete, nor has it been specifically requested, so lets remove to simplify the API.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bnjmnm created an issue. See original summary.

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Status: Active » Needs review
FileSize
4.22 KB

Having some trouble with the issue fork so here's a patch.

nod_’s picture

Status: Needs review » Needs work
  1. +++ b/src/a11y.autocomplete.js
    @@ -38,7 +38,7 @@
    + * <input data-autocomplete="{minChars: 3, path:'http://path-to-results'}" />
    

    was a problem before but still is, this is not valid json, json.parse won't work on this.

  2. +++ b/src/a11y.autocomplete.js
    @@ -38,7 +38,7 @@
      * <input data-autocomplete-max-items="10" data-autocomplete-path="http://path-to-results" />
    

    need to be changed too, leftover max-items.

  3. +++ b/src/a11y.autocomplete.js
    @@ -110,13 +108,10 @@
    +
    

    extra line

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
4.46 KB
1.38 KB

Addressing #3

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Removed this.totalSuggestions on commit because it wasn't used anymore.

nod_’s picture

Status: Reviewed & tested by the community » Fixed

  • nod_ committed 91a5ec8 on 1.0.x
    Issue #3236330 by bnjmnm: Remove maxResults feature
    
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andrewmacpherson’s picture

Good call. I was going to file an issue to remove it, but procrastinated. You got there already.

The maxResults feature is not needed for BC with jQuery UI Autocomplete, nor has it been specifically requested

Fair enough. I was bothered by it for a completely different reason though. It smacked of software trying to manage the user, rather than the user directing the action. Specifically this bit...

There are at least @count results available. Type additional characters to refine your search.',

This first withholds information from the user, and then makes them do additional work to obtain it. It runs counter to the oft-quoted book title: don't make me think.

Suppose maxItems is 10, and try these scenarios:

  • The user's query would produce 12 matches. Yet the one they need is item 12, so it's not shown. Why not just give them all 12 matches? Picking an item could be quicker/easier than having to re-think the query.
  • Suppose there's a large vocabulary behind the autocomplete field, and the user's query returns 120 matches. Saying "at least 10 results" hides the scale of what's available.

If the user is given all the results, they can decide for themselves whether they prefer to browse a large set, or narrow things down with a revised query. (A combobox or listbox can have any number of options; they're scrollable when they outgrow the available space.) The maxItems approach removes this choice, and forces the user to revise the query.

I think there's also a risk that users may (incorrectly) conclude that the thing they are looking for isn't available. Particularly sighted users, without a screen reader; the message was being conveyed in a visually-hidden "assistive hint". It sounds like this was trying to help blind users, but ended up discriminating against sighted users who aren't told this information.