autodoc: Use the search input's value on load #24467
Open
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After the sources tarball is loaded, check the search input for a value. If present, this means the user typed something into it during load - we should use that value for the initial search state instead of always respecting what the hash's search value is.
Updates for clarity:
history.state: {} => "keepScrollPosition" :: We're using state as a flag, but as it was an empty object, wasn't clear to me what it was being used for. Hopefully this state's value will be self-documenting and provide more clarity for future contributors.
onHashChange => handleNavigation :: onHashChange implies there's a onhashchange event that's being handled, which isn't the case.
Future considerations:
s
or?
shortcuts. it would be straightforward to shuffle things around to get these working, but I figured I'd keep this PR short.handleNavigation(null ... )
after tarball load forces a scroll to the top - I kept this behavior unchanged, but it does result in users losing their place via a refresh.Fixes #21458