Skip to content

DropDown Specification

Alexander M edited this page Apr 24, 2018 · 66 revisions

DropDown Specification

Contents

  1. Overview
  2. User Stories
  3. Functionality
  4. ARIA support
  5. Assumptions and Limitations
  6. References

Revision History

Version User Date Notes
0.1 Alexander Marinov April 20, 2018 Initial Draft

Objectives

The igx-dropdown should display a list of items and should support selection of a single item.

The igx-dropdown should display a scrollable list of items which may be visually grouped. Clicking or tapping an item should select the item and should close the drop down.

The igx-dropdown should appear above all other in-app UI elements.

As an end user, I want

  • to see a dropdown list of available choices
  • to select a choice using a mouse click
  • to select a choice using the SPACE and ENTER keys
  • to see the dropdown above all other elements on the page
  • to scroll the list of choices if they are too many
  • to see the choices grouped if applicable
  • to close the dropdown by selecting an item, by clicking outside the control or by pressing the ESC key
  • the dropdown to preserve selection
  • to have visual clue if a choice from the list is not selectable
  • to change the selected values indefinitely, so that I can change my choice.
  • to have or not animations on dropdown open, so that I have a meaningful interactions.
  • to have dropdown opening positions that are meaningful and dependent on my needs.
  • to have separators in the dropdown list, so that I have the items organized depening on my needs.

Developer Stories

As a developer, I want to

  • select an item
  • be notified, when selection has changed
  • be able to implement the dropdown to any kind of anchor.
  • open the dropdown within the viewport.
  • set max(min) width of the dropdown.
  • set max height, and if it is exeeded a vertical scroll schould appear.
  • have verticall scroll if the dropwdown reaches a viewport edge.
  • be able to select from different animations or disable all animation for the dropdown opening, so that the interaction is meaningful.
  • default opening positions (Top start, Top end, Bottom start, Bottom end, attempt to vertically align the currently selected anchor with the list item.)
  • be able to customize the opening position by anrchor margins (Top, Bottom, Left, Right) in pixels.
  • add a separator in the dropdown items so that I can organize them better.

3.1. End User Experience

Users are able to select an item from a predefined list of items which is displayed in the application UI.

3.2. Developer Experience

Developers are able to select items programatically like:

<igx-dropdown #dropdown [selectedItem]="2"></igx-dropdown>

Developers can also subscribe to an event emitted before the item selection is copmleted:

<igx-dropdown #dropdown (onSelection)="itemSelection(args)"></igx-dropdown>

3.3. Keyboard Navigation

The default way to select an item from the dropdown is by mouse click. However, selection is also possible using the ENTER and SPACE keys. Pressing UP and DOWN keys is changing the focus to the previous/next item but is not changing the selection. Pressing ENTER or SPACE key is closing the dropdown after the selection is changed.

Pressing the Esc key is closing the dropdown and is not changing the selection.

Pressing the Home key is scrolling the list to the top. The focus is set to the first item which is not disabled or header.

Pressing the End key is scrolling the list to the bottom. The focus is set to the last item which is not disabled or header.

Pressing the PageUp/PageDown keys is scrolling the list one page up/down.

3.4. API

Properties

IgxDropDownComponent

Name Description Type
selectedItem Sets/Gets the selected item string
tabIndex Sets the tab index of the control number
zIndex Sets the z-index for the control number
ariaLabelledby Specifies the aria-labelledby attribute string

IgxDropDownItemComponent

Name Description Type
selected Defines is the given item is selected boolean
disabled Disables the given item boolean
isHeader Defines if the item is a group header boolean
tabIndex Sets the tab index of the dropdown item number

Events

IgxDropDownComponent

Name Description Cancelable Parameters
onSelection Emitted when item selection is changing, before the selection completes. true { oldSelection: string, newSelection: string, event?: Event }

Note: igx-dropdown API selectedItem setter will trigger this event

We provide the ariaLabelledby property which the developer may use to provide essential information about the dropdown. If left empty, we should provide a default value.

The following components gets the corresponding aria attributes

  • the only mode of selection will be single
  • multiple selection is out of scope for the dropdown component and will be provided by another component.
  • moving the focus up and down via the keyboard will not change selection.
  • Pressing the Esc key will close the dropdown, but will not update the selection.

igxDropDown Issue https://material-components-web.appspot.com/select.html https://material.angular.io/components/select/overview https://material.angular.io/components/menu/overview https://material.io/guidelines/components/menus.html#menus-simple-menus

Clone this wiki locally