Skip to content

rustdoc: Properly restore search input placeholder #137055

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

Merged

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
@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Feb 15, 2025

📌 Commit 351cc1f has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 15, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#127581 (Fix crate name validation)
 - rust-lang#136490 (Do not allow attributes on struct field rest patterns)
 - rust-lang#136808 (Try to recover from path sep error in type parsing)
 - rust-lang#137055 (rustdoc: Properly restore search input placeholder)
 - rust-lang#137068 (fix(rustdoc): Fixed `Copy Item Path` in rust doc)
 - rust-lang#137070 (Do not generate invalid links in job summaries)
 - rust-lang#137074 (compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives)
 - rust-lang#137076 (triagebot.toml: ping me on changes to `tests/rustdoc-json`)

r? `@ghost`
`@rustbot` modify labels: rollup
@GuillaumeGomez
Copy link
Member

Could you also add a GUI test to prevent a regression please? :)

@fmease
Copy link
Member Author

fmease commented Feb 15, 2025

Since this already being tested by bors in a rollup, I'd do that in a separate PR. Note tho that as long as we continue using TypeScript, this won't regress.

@GuillaumeGomez
Copy link
Member

Yeah it's fine in another PR. Don't hesitate if you need my help. ;)

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#127581 (Fix crate name validation)
 - rust-lang#136490 (Do not allow attributes on struct field rest patterns)
 - rust-lang#136808 (Try to recover from path sep error in type parsing)
 - rust-lang#137055 (rustdoc: Properly restore search input placeholder)
 - rust-lang#137068 (fix(rustdoc): Fixed `Copy Item Path` in rust doc)
 - rust-lang#137070 (Do not generate invalid links in job summaries)
 - rust-lang#137074 (compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives)
 - rust-lang#137076 (triagebot.toml: ping me on changes to `tests/rustdoc-json`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit df7002f into rust-lang:master Feb 16, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 16, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2025
Rollup merge of rust-lang#137055 - fmease:rustdoc-js-fix-input-placeholder-logic, r=notriddle

rustdoc: Properly restore search input placeholder

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! :)
@fmease fmease deleted the rustdoc-js-fix-input-placeholder-logic branch February 16, 2025 09:53
@cuviper cuviper modified the milestones: 1.86.0, 1.87.0 Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants