Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(module:modal): call focus() on the next rendering frame to prevent frame drop #7293

Merged
merged 1 commit into from Apr 21, 2022

Commits on Mar 12, 2022

  1. perf(module:modal): call focus() on the next rendering frame to pre…

    …vent frame drop
    
    Calling `focus()` on the element causes browsers to do re-layouts. This can been seen here:
    https://gist.github.com/paulirish/5d52fb081b3570c81e3a#setting-focus
    Microtasks are executed asynchronously, but within the current rendering frame. Using `requestAnimationFrame`
    except of `Promise.resolve` basically unloads the current frame and calls `focus()` on the next rendering
    frame, this prevent frame drops on slower devices when the modal is opened.
    arturovt committed Mar 12, 2022
    Configuration menu
    Copy the full SHA
    8d7adbb View commit details
    Browse the repository at this point in the history