-
Notifications
You must be signed in to change notification settings - Fork 161
DropDown Specification
- Overview
- User Stories
- Functionality
- ARIA support
- Assumptions and Limitations
- Test scenarios
- References
Version | User | Date | Notes |
---|---|---|---|
0.1 | Alexander Marinov | April 20, 2018 | Initial Draft |
0.2 | Milko Venkov | April 25, 2018 | Add changes to API |
0.3 | Alexander Marinov | May 3, 2018 | Add changes to API |
0.4 | Alexander Marinov | May 9, 2018 | Update API and test scenarios |
0.5 | Milko Venkov | May 10, 2018 | Updating the API |
0.6 | Milko Venkov | May 15, 2018 | Updating the API |
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.
- to see a dropdown list of available choices
- to have a selection made by default
- not to have a selected item by default
- 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 be able to scroll navigate through the items using Up/Down arrow keys and Home/End keys.
- to see the choices grouped if applicable
- to close the dropdown by selecting an item 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 have visual clue if a choice from the list is selected, focused or hovered.
- 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.
- 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 the width of the dropdown.
- set the height, and if it is exceeded a vertical scroll should appear.
- have vertical scroll if the dropwdown reaches a viewport edge.
- be able to select from different animations or disable all animation for the dropdown opening/closing, 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 anchor 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:
igxDropDown.setSelectedItem(2);
Developers can also subscribe to an event emitted before the item selection is completed:
<igx-dropdown #dropdown (onSelection)="itemSelection($event)"></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 and set the focus to the first item which is not disabled or header.
Pressing the End key is scrolling the list and set the focus to the last item which is not disabled or header.
3.4. User Interface
Desktop:
Min Width = 2x64 Max WIdth 7x64 H of an item = 32px
Тext does not wrap.
3.6. API
IgxDropDownComponent
Name | Description | Type |
---|---|---|
selectedItem | Sets/Gets the selected item | number |
items | Gets all non-header items | IgxDropDownItemComponent[] |
headers | Gets all header items | IgxDropDownItemComponent[] |
allowItemsFocus | Allows items to take focus | boolean |
width | Sets/gets the tab width of the control | string |
height | Sets/gets the tab height of the control | string |
id | Sets/gets the dropdown's id | string |
element | Get dropdown html element | ElementRef |
collapsed | Gets if the dropdown is collapsed | bool |
IgxDropDownItemComponent
Name | Description | Type |
---|---|---|
isSelected | Gets if the item is the currently selected one in the dropdown | boolean |
disabled | Sets/gets if the given item is disabled | boolean |
isFocused | Sets/gets if the given item is focused | boolean |
isHeader | Sets/gets if the given item is header | boolean |
index | Gets item index | number |
elementHeight | Gets item element height | number |
element | Get item html element | ElementRef |
IgxDropDownComponent
Name | Description | Parameters |
---|---|---|
toggle | Toggles the dropdown | none |
open | Opens the dropdown | none |
close | Closes the dropdown | none |
setSelectedItem | Select an item by index | new selected item index |
IgxDropDownComponent
Name | Description | Cancelable | Parameters |
---|---|---|---|
onSelection | Emitted when item selection is changing, before the selection completes | false | {ISelectionEventArgs} |
onOpening | Emitted before the dropdown is opened | false | |
onOpened | Emitted after the dropdown is opened | false | |
onClosing | Emitted before the dropdown is closed | false | |
onClosed | Emitted after the dropdown is closed | false |
Note: igx-dropdown API setSelectedItem
method will trigger the onSelection
event
We provide the aria-selected
property which lets the screen readers know if an item is selected or not.
The following components gets the corresponding aria attributes
- selected item - aria-selected=true (https://www.w3.org/TR/wai-aria-1.1/#aria-selected)
- 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.
- Dropdown will not handle page up and page down key actions.
- Dropdown will not close on click outside the dropdown. This should be handled by the developer by adding IgxToggleAction directive to the caller of dropdown and setting its target to point to the dropdown's IgxToggle.
- We will provide default values for min/max-width with CSS and will allow the users to override those using the
width
property.
- The user should be able to select an item by SPACE/ENTER keys and by click
- The selection can be changed indefinitely
- The user can navigate through the items using Up/Down/Home/End keys
- The dropdown should support disabled items
- The items can be disabled/enabled at runtime
- The dropdown should support headers
- The dropdown should notify when the selection has changed
- The dropdown should persist selection through scrolling
- The Escape key should close the dropdown and should not change the selection
- The dropdown should not change selection when setting it to non-existing item
- Home key should focus the first enabled item
- End key should focus the last enabled item
- Key navigation through disabled items should skip the disabled items
- Width and height can be changed at rutime
- Disabled items cannot be focused
- Disabled items cannot be selected
- Items do not loose focus when a disabled item is clicked
- The dropdown shows/hides in a timely manner with a big number of items
- Focus is changed in a timely manner when navigating via keyboard
- The user may have more than one dropdown controls on the same page.
- The dropdown content should not "flicker" when opening
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