There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

focus-on-next-cycle

Syntax

focus-on-next-cycle: (selector set) [every (time)] [after (time)][, (element)...];

selector set = Any valid CSS selector referencing multiple elements.

When this command is run, the selector set will be scanned, and if the currently focused element is found in there, it will change the focus to the next element in the selector set.

If the focused element is already the last in the set, it will start the cycle again from the beginning of the selector set. Ie. the first element in the set will be focused.

This command runs a JavaScript "focus" event.

Note: This won't work well with click events triggering this action. The reason being that when you click, you lose the current focus. It is no longer part of the selector set - the focus gets put onto the object you clicked on. So it is best used with keyboard events. We may expand this to remember the last input field focused so the command ignores the click focus, but for now just use it with keyboard events. Being able to move up and down a list with a key was the reason the command was made - we use it for our search results. To try that out, search and then move up and down the list with the arrow keys.

Also note that it will only work on elements that can receive focus.

Example:

.srch-Res a:keydownArrowDown {
    focus-on-next-cycle: .srch-Res a;
}

If a search result "a" tag has focus, pressing the keyboard down arrow will move the focus to the next a tag in the selection. Once it reaches the bottom, it will go back to the top.

focus-on-next-cycle