You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: packages/mdc-list/README.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -359,6 +359,8 @@ When rendering list with checkbox items all pre-selected list items should conta
359
359
</ul>
360
360
```
361
361
362
+
The `selectedIndex` (that proxies foundation's `setSelectedState()`) accepts list of indexes in array format for list with checkbox items to set the selection state. It overwrites the current state with new selected state.
`setWrapFocus(value: Boolean) => void` | Sets the list to allow the up arrow on the first element to focus the last element of the list and vice versa.
518
521
`setVerticalOrientation(value: Boolean) => void` | Sets the list to an orientation causing the keys used for navigation to change. `true` results in the Up/Down arrow keys being used. `false` results in the Left/Right arrow keys being used.
519
522
`setSingleSelection(value: Boolean) => void` | Sets the list to be a selection list. Enables the `enter` and `space` keys for selecting/deselecting a list item.
520
-
`setSelectedIndex(index: Number) => void` | Toggles the `selected` state of the list item at index `index`.
523
+
`getSelectedIndex() => Index` | Gets the current selection state by returning selected index or list of indexes for checkbox based list. See [constants.js](./constants.js) for `Index` type definition.
524
+
`setSelectedIndex(index: Index) => void` | Sets the selection state to given index or list of indexes if it is checkbox based list. See [constants.js](./constants.js) for `Index` type definition.
521
525
`setUseActivated(useActivated: boolean) => void` | Sets the selection logic to apply/remove the `mdc-list-item--activated` class.
522
526
`handleFocusIn(evt: Event) => void` | Handles the changing of `tabindex` to `0` for all button and anchor elements when a list item receives focus.
523
527
`handleFocusOut(evt: Event) => void` | Handles the changing of `tabindex` to `-1` for all button and anchor elements when a list item loses focus.
524
528
`handleKeydown(evt: Event) => void` | Handles determining if a focus action should occur when a key event is triggered.
525
529
`handleClick(evt: Event) => void` | Handles toggling the selected/deselected state for a list item when clicked. This method is only used by the single selection list.
526
-
`focusNextElement(index: Number) => void` | Handles focusing the next element using the current `index`.
527
-
`focusPrevElement(index: Number) => void` | Handles focusing the previous element using the current `index`.
528
-
`focusFirstElement() => void` | Handles focusing the first element in a list.
529
-
`focusLastElement() => void` | Handles focusing the last element in a list.
530
+
`focusNextElement(index: number) => number` | Handles focusing the next element using the current `index`. Returns focused element index.
531
+
`focusPrevElement(index: number) => number` | Handles focusing the previous element using the current `index`. Returns focused element index.
532
+
`focusFirstElement() => number` | Handles focusing the first element in a list. Returns focused element index.
533
+
`focusLastElement() => number` | Handles focusing the last element in a list. Returns focused element index.
0 commit comments