Skip to content
  • bondd's avatar
    Fix two focus regressions in chrome://settings/autofillEditAddress page. · 10a45b90
    bondd authored
    Sets list item selection and focus correctly when edit is committed in
    name/phone/email lists on chrome://settings/autofillEditAddress page.
    
    "Correctly" means the just-edited list item remains the selected item in
    the list, and the next focusable element after the list gets focus. The
    list no longer has focus, but if the user gives focus back to the list
    using tab/shift+tab then the just-edited list item will receive focus.
    
    This is different than the default InlineEditableItemList behavior
    because most addresses will have only a single name/phone/email, so it's
    better to move to the next field type rather than to the "Add another"
    placeholder of the same field type. I tried to keep the changes
    contained to autofill_options_list.js because that's the only page that
    needs this focus behavior. Generalizing the code into
    inline_editable_list.js might result in more regressions to fix
    elsewhere.
    
    The fix implementation is to disable list events during list operations
    in autofillOptions.ValuesListItem.onEditCommitted_, so that focus is not
    returned back to the list that was just tabbed away from. Then
    onEditCommitted_ calls the new
    InlineEditableItemList.SelectIndexWithoutFocusing method to set the
    selected list item without setting focus back to the list.
    
    Same fix for both regressions.
    
    https://crbug.com/440760 was caused by me.
    https://crbug.com/443491 was from a CL by hcarmona@, but we agreed I
    should take it because I'm more familiar with this code.
    
    BUG=440760,443491
    
    Review URL: https://codereview.chromium.org/819193003
    
    Cr-Commit-Position: refs/heads/master@{#314675}
    10a45b90