Navigation mode defines the list navigation experience for the user. You define this in a view for a given Moment and must choose between the several experiences available. Navigation mode supports using conditionals, so you can adjust the experience, depending on how many items the user can choose from or if the device is in hands-free mode. For more information on when to use the different read modes, see the Hands-Free and Multiple Devices Design Guide.
When enhanced-list-navigation
is enabled and the request is hands-on, the navigation-mode
block will not be evaluated. With enhanced list navigation, navigation-mode
only defines your capsule's behavior in hands-free mode.
If your capsule does not enable enhanced-list-navigation
, you can check the $handsFree
EL variable to determine whether the request is in hands-free or hands-on mode.
The following example follows an Input Moment example with an input-view
.
input-view {
match: Person (candidates) {
from-output: FindPerson {
from-input: PersonName (name)
}
}
message {
macro (PERSON_SELECTION_PROMPT)
}
render {
selection-of (candidates) {
navigation-mode {
if ($handsFree) {
read-one {
with-navigation-conversation-drivers
list-summary {
macro (HANDS_FREE_PERSON_LIST_SUMMARY) {
param (name) {
if (exists(name)) {
expression (name)
}
}
}
}
page-content {
item-selection-question {
macro (HANDS_FREE_PERSON_ITEM_SELECTION_QUESTION)
}
overflow-statement {
macro (HANDS_FREE_PERSON_OVERFLOW_STATEMENT)
}
overflow-question {
macro (HANDS_FREE_PERSON_OVERFLOW_QUESTION)
}
underflow-statement {
macro (HANDS_FREE_PERSON_UNDERFLOW_STATEMENT)
}
}
}
}
}
where-each (candidate) {
macro (PERSON_SUMMARY) {
param (person) {
expression (candidate)
}
}
spoken-summary {
template ("#{value(candidate.name)}")
}
}
}
}
}
Here is an example of a Result Moment with a result-view
:
result-view {
match {
Movie (results)
}
message {
if (size(results) == 0) {
template ("#{event(results, 'NoResult')}")
} else {
template ("#{event(results, 'Result')}")
}
}
render {
if (size(results) == 1) {
macro (MOVIE_DETAILS) {
param (movie) {
expression (results)
}
}
}
else-if (size(results) > 1) {
list-of (results) {
navigation-mode {
if ($handsFree) {
read-one {
list-summary {
template ("#{event(results, 'Result')}")
}
page-content {
item-selection-question {
macro (HANDS_FREE_MOVIE_ITEM_SELECTION_QUESTION)
}
overflow-statement {
macro (HANDS_FREE_MOVIE_OVERFLOW_STATEMENT)
}
overflow-question {
macro (HANDS_FREE_MOVIE_OVERFLOW_QUESTION)
}
underflow-statement {
macro (HANDS_FREE_MOVIE_UNDERFLOW_STATEMENT)
}
}
}
}
}
highlights {
select (pick) {
label {
macro (MOVIE_HIGHLIGHT_LABEL)
}
macro (MOVIE_HIGHLIGHT) {
param (movie) {
expression (pick)
}
}
summary {
macro (HANDS_FREE_MOVIE_HIGHLIGHT_SUMMARY) {
param (movie) {
expression (pick)
}
}
}
}
}
where-each (result) {
if ($handsFree) {
macro (MOVIE_HIGHLIGHT) {
param (movie) {
expression (result)
}
}
}
else {
macro (MOVIE_SUMMARY) {
param (movie) {
expression (result)
}
}
}
spoken-summary {
macro (HANDS_FREE_MOVIE_NORMAL_SUMMARY) {
param (movie) {
expression (result)
}
}
}
}
}
}
}
}
read-manual optional | Starts a navigation mode that allows manual definition of paging intents |
read-many optional | Reads several items in a list to a user and asks if the user would like to choose one of the items on the current page |
read-many-and-next optional | Reads several items on the results list and asks the user if they'd like the next page of results read |
read-one optional | Reads one item at a time for the reader and then asks if the user wants to choose it |
read-one-and-next optional | Reads an item from the given list and asks the user if they want to hear the next item on the list |