accessibleItemActivation property

bool get accessibleItemActivation

Implementation

bool get accessibleItemActivation => _accessibleItemActivation;
  1. @Input.new()
set accessibleItemActivation (bool value)

Whether suggestions should be smartly activated / highlighted.

Defaults to true.

When true:

  • If selection has selected values, the first selected value in options is activated / highlighted when the suggestions list opens. Justification - "If one or more options are selected before the listbox receives focus, focus is set on the first option in the list that is selected". https://www.w3.org/TR/wai-aria-practices/#Listbox

  • If selection is empty, the first value in options is activated / highlighted when the suggestions list opens. Justification - "If none of the options are selected before the listbox receives focus, focus is set on the first option...". https://www.w3.org/TR/wai-aria-practices/#Listbox

  • If selection is a MultiSelectionModel, deactivate any active suggestions when the search text changes. This does not apply for any text changes caused by shouldClearInputOnSelection or when the suggestions list opens. Justification - The W3 listbox spec (see above for link) says that <Space> "changes the selection state of the focused option" for multi-select listboxes. This means that a user cannot type a space into the textbox with an option focused, the space would be captured and used to toggle selection instead of typing a space. Clearing "focus" (deactivating) on any option makes it easy for the user to type a space into the textbox.

When false:

  • if selection isSingleSelect, don't auto activate / highlight any options.

  • if selection isMultiSelect, activate / highlight the first value when the suggestions list opens. Also, do not clear the active item when the search text changes.

Implementation

@Input()
set accessibleItemActivation(bool value) {
  _accessibleItemActivation = value;
  activeModel.activateFirstItemByDefault =
      (isSingleSelect && value) || (isMultiSelect && !value);
}