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

Closed
2 of 10 tasks
bsvensson opened this issue Aug 12, 2024 · 8 comments
Closed
2 of 10 tasks

[New component] Autocomplete #10044

bsvensson opened this issue Aug 12, 2024 · 8 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. 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. estimate - 8 Requires input from team, consider smaller steps. 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, #10186

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 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 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-bottom - A slot for adding content below calcite-autocomplete-item elements.
  • content-top - A slot for adding content above 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: FlipContext;
  • 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.

CalciteAutocompleteItemGroup

<calcite-autocomplete-item-group heading="Locations"></calcite-autocomplete-item-group>

Properties

  • heading: string;
  • label: string;
  • scale: Scale;

Events

None

Methods

  • None

Slots

  • default: slot for adding autocomplete items.

Figma Spec

In progress design spec for Autocomplete, Autocomplete Item, and Autocomplete Item Group. Will update as needed during development.

@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
@geospatialem geospatialem added 2 - in development Issues that are actively being worked on. estimate - 8 Requires input from team, consider smaller steps. and removed 0 - new New issues that need assignment. labels Dec 2, 2024
@driskull driskull removed the 2 - in development Issues that are actively being worked on. label Dec 18, 2024
@driskull driskull added the 3 - installed Issues that have been merged to master branch and are ready for final confirmation. label Dec 18, 2024
Copy link
Contributor

Installed and assigned for verification.

@github-actions github-actions bot assigned geospatialem and DitwanP and unassigned driskull Dec 18, 2024
@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Dec 18, 2024
@geospatialem
Copy link
Member

Verified in 3.0.0-next.76 with https://codepen.io/geospatialem/pen/wBwGMdz.

image

driskull added a commit that referenced this issue Dec 19, 2024
…utValue on form reset (#11099)

**Related Issue:** #10044

## Summary

- opens autocomplete when input is clicked
- This is useful for when the input is already focused but the
autocomplete is closed.
- Sets focus and sets `open=false` when `autocomplete-item` is clicked
- ensures that the input receives focus after an `autocomplete-item` is
clicked
- use `enterKeyHint` property JSX
- update `onFormReset` to be called after form component logic
- This allows us to reset the `inputValue` to the `defaultInputValue`
without overriding existing logic
- adds autocomplete to validation demo

cc @benelan 


BEGIN_COMMIT_OVERRIDE
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. 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. estimate - 8 Requires input from team, consider smaller steps. 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

4 participants