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

rustdoc: Properly restore search input placeholder #137055

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fmease
Copy link
Member

@fmease fmease commented Feb 15, 2025

Fix the search input placeholder literally getting set to the string undefined on blur/defocus.
This was caused by us trying to access an undefined property in the event listener.
To prevent this from regressing again, stop typescript from ignoring the relevant site.

Steps to reproduce the bug fixed in this PR:

  1. Focus the search input field by clicking on it and clear the input if necessary
  2. Blur/defocus it by clicking somewhere outside of it

First bug that would've been caught by TSC if we had had it earlier! Type (quasi-)safety, ahoy! :)

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2025

r? @notriddle

rustbot has assigned @notriddle.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2025

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

Copy link
Member Author

@fmease fmease Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, the minimal fix would be:

  searchState.input.addEventListener("blur", () => {
-     searchState.input.placeholder = searchState.input.origPlaceholder;
+     searchState.input.placeholder = searchState.origPlaceholder;
  });

@fmease fmease force-pushed the rustdoc-js-fix-input-placeholder-logic branch from 844ae51 to 351cc1f Compare February 15, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants