Menu Focus Change (Deprecated)

ui:menuFocusChange

Deprecated as of API version 47.0. Use lightning:buttonMenu instead.

::::::tabset{tabs='[ "Develop", "Specifications"]'}

:::::tab

This event is fired when you scroll up and down the ui:menuList component, which triggers a focus change in menu items. To set a handler for the ui:menuFocusChange event, use the menuFocusChange attribute on ui:menuList.

The following example shows a menu with two list items. The handleChange client-side controller handles the ui:menuFocusChange event.

<aura:component>
  <ui:menu>
    <ui:menuTriggerLink aura:id="trigger" label="Contacts" />
    <ui:menuList class="actionMenu" aura:id="actionMenu" menuFocusChange="{!c.handleChange}">
      <ui:actionMenuItem aura:id="item1" label="All Contacts" />
      <ui:actionMenuItem aura:id="item2" label="All Primary" />
    </ui:menuList>
  </ui:menu>
</aura:component>

If you're using this event with a component other than ui:menuList, register the event first.

<aura:registerEvent
  name="menuFocusChange"
  type="ui:menuFocusChange"
  description="The event fired when the menu list focus changes from one menu item to another."
/>

:::::

:::::tab

Attributes

Name Description Type Default Required
currentItem The menu item that's currently focused. component[]
previousItem The menu item that's previously focused. component[]

:::::

::::::