• Luciano Pacheco's avatar
    Files app: Force focus out of <body> · 2bbea72b
    Luciano Pacheco authored
    When the element has the focus is hidden/removed/disabled the browser
    moves the focus to <body>, in this situation user doesn't have any
    visual clue where is the focus. To fix this we move the focus from
    <body> to file list which is the default element when opening Files app.
    
    Use "focusin" and "focusout" in the <body> element, because these two
    events bubble from any body's child element, whereas "focus" event
    doesn't. In the event handler we use requestIdleCallback() to give a
    chance for any synchronous code to finish and potentially set the focus
    somewhere else other than <body>.
    
    Test: browser_tests --gtest_filter="*tabindexFocusBody*"
    Bug: 1059137,957413
    Change-Id: I9563294a3b6c541cf6bd2bba03470041bc8af41b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089444Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
    Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
    Commit-Queue: Noel Gordon <noel@chromium.org>
    Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#748090}
    2bbea72b
file_manager_browsertest.cc 40.9 KB