Skip to content

[Feature][UI] Implement Sticky Kernel Selector in Overview #43

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

Closed
wants to merge 3 commits into from

Conversation

FindHao
Copy link
Member

@FindHao FindHao commented Jul 24, 2025

This pull request introduces a significant UI/UX enhancement to the KernelOverview page by implementing a sticky/floating header for the "Available Kernels" selector. This feature improves usability, especially on pages with many kernels, by ensuring the kernel selection controls are always accessible.

Key Features and Changes:

  1. Sticky by Default: The "Available Kernels" section now sticks to the top of the viewport by default as the user scrolls down the page.
  2. User-Controlled Toggle: A toggle switch has been added next to the "Available Kernels" title, allowing users to enable or disable the sticky functionality as needed.
  3. Smart Collapsing:
    • To conserve screen space, the sticky header automatically collapses to show only the first row. This preserves the context of adjacent kernels, which was a key part of the feedback during development.
    • When the user hovers over the collapsed bar, it smoothly expands to show all available kernels.
  4. Compact Sticky Design: When in the sticky state, the entire header becomes more compact:
    • The "Available Kernels" title text is smaller.
    • The kernel selection buttons and the gaps between them are reduced in size.
    • Overall padding and margins are tightened.
  5. Robust and Responsive: The component is fully responsive. It uses a useLayoutEffect hook to track the positions of the kernel buttons and correctly scrolls the active row into view. A resize event listener ensures this logic re-runs if the browser window is resized, so the correct row is always shown.

Implementation Details:

  • A new reusable ToggleSwitch.tsx component was created.
  • The logic is self-contained within KernelOverview.tsx, using React hooks (useState, useRef, useCallback, useLayoutEffect) for state management and DOM interaction.
  • Styling is handled with conditional Tailwind CSS classes to ensure a smooth transition between states.

Default sticky and collapsed view:
sticky

Expanded view on hover:
hover

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 24, 2025
@facebook-github-bot
Copy link
Contributor

@FindHao has imported this pull request. If you are a Meta employee, you can view this in D78920093.

@facebook-github-bot
Copy link
Contributor

@FindHao has imported this pull request. If you are a Meta employee, you can view this in D78920093.

@FindHao FindHao requested a review from davidberard98 July 25, 2025 16:02
@facebook-github-bot
Copy link
Contributor

@FindHao has imported this pull request. If you are a Meta employee, you can view this in D78920093.

@facebook-github-bot
Copy link
Contributor

@FindHao merged this pull request in 267678d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants