Class sap.ui.core.delegate.ItemNavigationModule: sap/ui/core/delegate/ItemNavigation
Delegate for the navigation between DOM nodes with the keyboard.
The ItemNavigation
provides keyboard and mouse navigation between DOM nodes representing items. This means that controls rendering a list of items can attach this delegate to get a common keyboard and mouse support to navigate between these items. It is possible to navigate between the items via the arrow keys. If needed, paging using the Page Up and Page Down keys is possible. (To activate call setPageSize
with a value > 0.) HOME and END keys are also supported. Focusing an item via mouse also is also supported. For mouse navigation, the mousedown
event is used.
As the ItemNavigation
works with DOM nodes, the items and the control area must be provided as DOM references. There is one root DOM reference (set via setRootDomRef
). All item DOM references (set via setItemDomRefs
) must be places somewhere inside of this root DOM reference. Only focusable items are used for the navigation, meaning disabled items or separator items are just ignored by navigating through the items. In some cases however, it makes sense to put the non-focusable items in the array of the DOM references to keep the indexes stable or like in the calling control. Hint: To make a DOM reference focusable a tabindex
of -1 can be set.
Note After re-rendering of the control or changing the DOM nodes of the control, the DOM references of the ItemNavigation
must be updated. Then the same item (corresponding to the index) will get the focus.
The ItemNavigation
adjusts the tabindex
of all DOM references relating to the current focused item. So if the control containing the items gets the focus (e.g. via tab navigation), it is always the focused items which will be focused.
Note: If the ItemNavigation
is nested in another ItemNavigation
(e.g. SegmentedButton
in Toolbar
), the RootDomRef
will always have tabindex
-1.
Per default the ItemNavigation
cycles over the items. It navigates again to the first item if the Arrow Down or Arrow Right key is pressed while the last item has the focus. It navigates to the last item if arrow up or arrow left is pressed while the first item has the focus. If you want to stop the navigation at the first and last item, call the setCycling
method with a value of false
.
It is possible to have multiple columns in the item navigation. If multiple columns are used, the keyboard navigation changes. The Arrow Right and Arrow Left keys will take the user to the next or previous item, and the Arrow Up and Arrow Down keys will navigate the same way but in a vertical direction.
The ItemNavigation
also allows setting a selected index that is used to identify the selected item. Initially, if no other focus is set, the selected item will be the focused one. Note that navigating through the items will not change the selected item, only the focus. (For example a radio group has one selected item.)
ItemNavigation
delegate that can be attached to controls requiring capabilities for keyboard navigation between items.ItemNavigation
.sClassName
and enriches it with the information contained in oClassInfo
.ItemNavigation
ItemNavigation
Example: Disable shift + up handling of the ItemNavigation
oItemNavigation.setDisabledModifiers({ sapnext : ["shift"] }); Possible keys are : "shift", "alt", "ctrl", "meta" Possible events are : "sapnext", "sapprevious", "saphome", "sapend"
ItemNavigation
should use the table mode to navigate through the items (navigation in a grid).ItemNavigation
delegate that can be attached to controls requiring capabilities for keyboard navigation between items. {Element} | oDomRef | The root DOM reference that includes all items |
{Element[]} | aItemDomRefs | Array of DOM references representing the items for the navigation |
{boolean} | bNotInTabChain? | Whether the selected element should be in the tab chain or not |
{int} | index | Index of the item |
{jQuery.Event} | event | Event that leads to the focus change |
{int} | index | Index of the item |
{jQuery.Event} | event | Event that leads to the focus change |
For example if the first item is focused and the Arrow Left key is pressed.
{int} | index | Index of the item |
{jQuery.Event} | event | Event that leads to the focus change |
{int} | index | Index of the item |
{jQuery.Event} | event | Event that leads to the focus change |
ItemNavigation
. {int} | index | Index of the item |
{jQuery.Event} | event | Event that leads to the focus change |
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.base.EventProvider.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
ItemNavigation
{object} | oDisabledModifiers | Object that includes event type with disabled keys as an array |
{object} | Object that includes event type with disabled keys as an array |
{Element[]} | Array of item DOM references |
{Element} | Root DOM reference |
{jQuery.Event} | oEvent | jQuery event |
{Boolean} | Flag if disabled modifiers are set |
If columns are used, the Arrow Up and Arrow Down keys navigate to the next or previous item of the column. If the first or last item of the column is reached, the next focused item is then in the next or previous column.
{int} | iColumns | Count of columns for the table mode or cycling mode |
{boolean} | bNoColumnChange | Forbids jumping to an other column with Arrow Up and Arrow Down keys |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
ItemNavigation
should cycle through the items. If cycling is disabled the navigation stops at the first and last item, if the corresponding arrow keys are used.
{boolean} | bCycling | Set to true if cycling should be done, else false |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
ItemNavigation
Example: Disable shift + up handling of the ItemNavigation
oItemNavigation.setDisabledModifiers({
sapnext : ["shift"]
});
Possible keys are : "shift", "alt", "ctrl", "meta"
Possible events are : "sapnext", "sapprevious", "saphome", "sapend"
{Object} | oDisabledModifiers | Object that includes event type with disabled keys as an array |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
{boolean} | bStayInRow | HOME -> go to first item in row; END -> go to last item in row |
{boolean} | bCtrlEnabled | HOME/END with CTRL -> go to first/last item of all |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
{Element[]} | aItemDomRefs | Array of DOM references representing the items |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
{int} | iPageSize | The page size, needs to be at least 1 |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
{object} | oDomRef | Root DOM reference |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
{int} | iIndex | Index of the first selected item |
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |
ItemNavigation
should use the table mode to navigate through the items (navigation in a grid). {boolean} | bTableMode | Set to true if table mode should be used, else false |
{boolean} | bTableList? | This sets a different behavior for table mode. In this mode we keep using table navigation but there are some differences. e.g.
|
{sap.ui.core.delegate.ItemNavigation} | this to allow method chaining |