Skip to content

rustdoc: Simplify tabs handling in "settings" popover - #165714

Open
GuillaumeGomez wants to merge 3 commits into
rust-lang:mainfrom
GuillaumeGomez:rm-js-tabs
Open

GuillaumeGomez wants to merge 3 commits into
rust-lang:mainfrom
GuillaumeGomez:rm-js-tabs

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

Follow-up of #163224.

Instead of using JS to change tab, we can just rely on CSS. I got the idea while updating #147909.

You can test it here.

r? @notriddle

@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @lolbinarycat

@rustbot rustbot added A-rustdoc-js Area: Rustdoc's JS front-end 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Nov 9, 2026
// We ensure its height is smaller than the window's, but its content's height is bigger.
store-property: ("#settings .settings .setting", {"offsetHeight": menu_height, "scrollHeight": scroll_height})
store-property: (
"#settings .tabs",

@GuillaumeGomez GuillaumeGomez Nov 9, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Small changes about the scrolling here: to make it work with only one CSS for all viewport size, I made the tabs labels "sticky", so now the whole content of the popover is scrollable, hence why we look at this selector now.

View changes since the review

@notriddle

Copy link
Copy Markdown
Contributor
image

I question whether this counts as a simplification.

  • Is there any specific reason to prefer the radio buttons other than "CSS good, JS bad?"
  • This PR doesn't change the way search tabs work.
  • This PR changes the way keyboard interactions work on the Settings popover tabs, which is particularly bad because it doesn't change the way search tabs work. I'm weakly in favor of being consistent with desktop GUIs, but I'm very strongly in favor of being consistent with ourselves.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

6 lines are added in a GUI test, so it's +59 -64. And it will allow to make it simpler for me to add tabs in the help popover (cc #147909) and simplify the search tabs too.

@notriddle notriddle removed the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 22, 2026
@notriddle

notriddle commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

@rfcbot fcp merge rustdoc-frontend

Okay, I understand the code, and it seems fine. But since this is a plan for a major change in how keyboard interaction works, it'll be an FCP.

@rust-rfcbot

rust-rfcbot commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

@notriddle has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Nov 22, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

I wonder if I can set a tabindex on the labels directly instead. Worth a try.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

I simplified the DOM and the CSS and added JS to handle the tab/space/enter events for the labels. Still simpler that the previous code as it allows to not have to care about setting up JS for the tabs labels as it's done at the top-level directly and will allow to unify this handling for everything which uses the same tab system (looking at you search results). That should also make my life a lot simpler for the help popover menu.

Since we're back to the previous tab/space/enter event system, I suppose the FCP can be closed?

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-js Area: Rustdoc's JS front-end disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants