Skip to content

Hide the sidebar when collapsed to prevent browser search to find text from it #2725

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
merged 4 commits into from
Jul 7, 2025

Conversation

GuillaumeGomez
Copy link
Member

Fixes #2721.

For the GUI test, I need to add a new command to ensure the text is not searchable when collapsed. I opened an issue for that in browser-ui-test: GuillaumeGomez/browser-UI-test#659.

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Jun 5, 2025
@GuillaumeGomez GuillaumeGomez requested a review from ehuss June 5, 2025 14:29
@GuillaumeGomez GuillaumeGomez force-pushed the search-collapsed branch 4 times, most recently from 44dfae5 to 9c1d6db Compare June 5, 2025 15:10
@GuillaumeGomez
Copy link
Member Author

Thanks to the GUI tests, I uncovered the case where the window size is too small and therefore the sidebar should not be displayed by default. =D

@GuillaumeGomez
Copy link
Member Author

Anyway, it's ready for review.

@ehuss
Copy link
Contributor

ehuss commented Jun 21, 2025

Thank you very much!

This seems to introduce a few regressions:

  • On Safari, the animation to display the sidebar seems broken. The sidebar pops into existence without animating, but the rest of the page animates over on top of it.
  • On Firefox, if the window is below 1080px wide, and the sidebar is visible, reloading the page shows a blank sidebar. Normally it should reset so that the page loads with the sidebar hidden.

Would you be able to look into those issues?

@GuillaumeGomez
Copy link
Member Author

On safari, sadly no. But on firefox, definitely. :)

@GuillaumeGomez
Copy link
Member Author

Fixed. I also extended the GUI test to ensure it doesn't happen again.

GuillaumeGomez and others added 4 commits July 7, 2025 09:47
When showing the sidebar, Safari was causing the sidebar to snap into
place without animating. This is apparently some well-known issue where
it doesn't like adding new elements (or changing display) and toggling
an animated transition in the same event loop.
@ehuss ehuss force-pushed the search-collapsed branch from f4eacc3 to d1c0979 Compare July 7, 2025 16:50
@ehuss
Copy link
Contributor

ehuss commented Jul 7, 2025

Thanks, I think I have fixed the issue that was happening on Safari.

@ehuss ehuss added this pull request to the merge queue Jul 7, 2025
Merged via the queue into rust-lang:master with commit 1476ec7 Jul 7, 2025
14 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label Jul 7, 2025
@GuillaumeGomez GuillaumeGomez deleted the search-collapsed branch July 7, 2025 19:19
// Workaround for Safari skipping the animation when changing
// `display` and a transform in the same event loop. This forces a
// reflow after updating the display.
sidebar.offsetHeight;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm very confused about this fix considering it does nothing. Dark magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Browser search finds sidebar text when it is hidden
3 participants