Skip to content

rename noScroll and keepFocus options #16479

Description

@Rich-Harris

Describe the problem

Context here: #16449 (comment). Please no PRs for this until that one is merged.

Basically, goto(url, { keepFocus: true }) is a lie. It means 'don't focus the <body>, but it doesn't actively keep the focus — something on the new page might change it to something entirely different. The addition of the shallow: true option in #16449 magnifies this issue by defaulting keepFocus to true, even though a common use case is opening a modal which definitely should update the focused element.

And next to keepFocus, the noScroll name is weird. Names that describe what doesn't happen are bad at the best of times, but having a modifier like no alongside a verb like keep is unforgivable. We should try to use active (and more consistent) language.

Describe the proposed solution

goto(url, {
  resetFocus: false,
  resetScroll: false
});

Both options would default to true, except in the shallow: true case in which they would default to false.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions