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

[New component] Autocomplete #10044

Open
2 of 10 tasks
bsvensson opened this issue Aug 12, 2024 · 6 comments
Open
2 of 10 tasks

[New component] Autocomplete #10044

bsvensson opened this issue Aug 12, 2024 · 6 comments
Labels
0 - new New issues that need assignment. ArcGIS Knowledge Issues logged by ArcGIS Knowledge team members. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. design Issues that need design consultation prior to development. enhancement Issues tied to a new feature or request. epic Large scale issues to be broken up into sub-issues and tracked via sprints and/or project. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone new component Issues tied to a new component. p - high Issue should be addressed in the current milestone, impacts component or core functionality

Comments

@bsvensson
Copy link
Member

bsvensson commented Aug 12, 2024

Check existing issues

Description

We would like the combobox component to support async data, actions, a menu for switching sources and have the ability to show a suggestion/autocomplete list.

Blocked issues: #8877

Acceptance Criteria

Relevant Info

Ask @driskull for details ;)

Which Component

calcite-combobox

Example Use Case

We are trying to move the Search widget to Calcite Components.

  • Currently that widget use a filter component, combobox and input and neither handles searching dynamic data or has the ability to show a suggestion/autocomplete list. We would like enhancements to calcite-combobox to support this.

Priority impact

impact - p1 - need for current milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

CalciteAutocomplete

  • Internally uses a new calcite-input-search component or calcite-input
  • When autocomplete items are populated and the input is clicked or ArrowUp/ArrowDown the component is opened. (open=true)
  • Users perform some async search when the calciteAutocompleteTextInput event fires, populate the autocomplete list and open it if needed.
  • Users listen to keydown (Enter) on the component or listen for a form submission to do a regular search.
  • Handle use case: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-search-multiplesource
  • When a user selects an autocomplete item, a dev can listen for the event and choose to populate or clear the inputText value or not.
  • Autocomplete results area has a live region with count of results.

Proposed HTML

<calcite-autocomplete open scale="m" value="1" input-value="Redlands, CA">
  <calcite-autocomplete-item value="1" heading="Redlands, CA"></calcite-autocomplete-item>
  <calcite-autocomplete-item value="2" heading="Redlands, CO, USA"></calcite-autocomplete-item>
  <calcite-autocomplete-item value="2" heading="Redlands, Dorset, England, GBR"></calcite-autocomplete-item>
  <calcite-autocomplete-item value="2" heading="Redlands, Wiltshire, England, GBR"></calcite-autocomplete-item>
</calcite-autocomplete>

Properties

All of the properties from calcite-input-search excluding pattern and readonly plus these additional properties:

  • value: string; // the value of the selected auto complete item. (used for form submissions)
  • inputValue: string; // the input text value.
  • open: boolean;
  • overlayPositioning: OverlayPositioning = "absolute";
  • placement: Placement;
  • flipPlacements: FlipPlacement[];
  • messageOverrides: { label: string; clear: string; };

Events

  • calciteAutocompleteTextChange: EventEmitter; // Fires each time a new value is typed and committed.
  • calciteAutocompleteTextInput: EventEmitter; // Fires each time a new value is typed.
  • calciteAutocompleteChange: EventEmitter; // Fires each time an autocomplete item is clicked.
  • calciteAutocompleteBeforeClose: EventEmitter;
  • calciteAutocompleteClose: EventEmitter;
  • calciteAutocompleteBeforeOpen: EventEmitter;
  • calciteAutocompleteOpen: EventEmitter;

Methods

  • selectText()
  • setFocus()

Slots

  • (default): A slot for adding calcite-autocomplete-item elements.
  • content-start: A slot for adding content above calcite-autocomplete-item elements.
  • content-end: A slot for adding content below calcite-autocomplete-item elements.

CalciteAutocompleteItem

<calcite-autocomplete-item value="1" heading="Redlands, CA"></calcite-autocomplete-item>

Properties

  • description: string;
  • disabled = false;
  • icon-start: IconNameOrString;
  • icon-end: IconNameOrString;
  • iconFlipRtl = false;
  • selected = false; // maybe we don't need this?
  • heading: string;
  • value!: any; // string?
  • label: any;

Events

None

Methods

  • None

Slots

  • content-start - A slot for adding non-actionable elements before content of the component.
  • content-end - A slot for adding non-actionable elements after content of the component.
@bsvensson bsvensson added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Aug 12, 2024
@github-actions github-actions bot added ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone labels Aug 12, 2024
@driskull
Copy link
Member

https://www.syncfusion.com/blogs/post/which-control-should-i-use-autocomplete-or-combobox

This article shows the difference between combobox and autocomplete.

@geospatialem geospatialem added this to the 2024-12-17 - Dec Release milestone Aug 13, 2024
@geospatialem geospatialem added p - high Issue should be addressed in the current milestone, impacts component or core functionality design Issues that need design consultation prior to development. and removed needs triage Planning workflow - pending design/dev review. labels Aug 13, 2024
@geospatialem
Copy link
Member

Related for discussion: #8877

@driskull
Copy link
Member

The aria-autocomplete attribute can be associated with the following roles: combobox, textbox, or searchbox.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete#associated_roles

@geospatialem geospatialem added the ArcGIS Knowledge Issues logged by ArcGIS Knowledge team members. label Aug 29, 2024
@geospatialem
Copy link
Member

+1 for ArcGIS Knowledge

@driskull
Copy link
Member

@geospatialem can we repurpose this issue to "Add autocomplete component"?

We'll also need issues for:

  • Add input-search component (ideally autocomplete would use this component + add autocomplete functionality)
  • Deprecate filter once we have input-search and autocomplete components

@geospatialem geospatialem added the new component Issues tied to a new component. label Aug 29, 2024
@geospatialem geospatialem changed the title more dynamic calcite-combobox with ability to show suggestion/autocomplete list Add autocomplete component Aug 29, 2024
Copy link
Contributor

cc @ashetland, @SkyeSeitz, @brittneytewks

@geospatialem geospatialem changed the title Add autocomplete component [New component] Autocomplete Aug 29, 2024
@geospatialem geospatialem added the epic Large scale issues to be broken up into sub-issues and tracked via sprints and/or project. label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. ArcGIS Knowledge Issues logged by ArcGIS Knowledge team members. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. design Issues that need design consultation prior to development. enhancement Issues tied to a new feature or request. epic Large scale issues to be broken up into sub-issues and tracked via sprints and/or project. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone new component Issues tied to a new component. p - high Issue should be addressed in the current milestone, impacts component or core functionality
Projects
None yet
Development

No branches or pull requests

3 participants