Skip to content

Keep horizontal scrollbar visible in responsive#1409

Open
abcampo-iry wants to merge 2 commits intomainfrom
issues/1196-horizontal-scroll-on-top
Open

Keep horizontal scrollbar visible in responsive#1409
abcampo-iry wants to merge 2 commits intomainfrom
issues/1196-horizontal-scroll-on-top

Conversation

@abcampo-iry
Copy link
Copy Markdown
Contributor

@abcampo-iry abcampo-iry commented Mar 27, 2026

Closes: https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1196

The intent of this PR is being able to show a responsive overflow bar when we are in responsive.
To achieve this it's been:

  • Added overlayscrollbars and overlayscrollbars-react container that handles this logic (MIT License 13kb gziped)
  • Added custom css to cover the exact usecase to reserve some space and make the scrollbar visibile on responsive
Screen.Recording.2026-03-27.at.15.50.35.mov

Add OverlayScrollbars and the React wrapper as dependencies for the Scratch editor.
The package is MIT-licensed and covers the custom horizontal scrollbar behavior we need on macOS/Chrome.
This commit only adds the dependency and wires its base styles into the standard app bundle and the web component bundle.
@abcampo-iry abcampo-iry temporarily deployed to previews/1409/merge March 27, 2026 14:22 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry self-assigned this Mar 27, 2026
@abcampo-iry abcampo-iry marked this pull request as ready for review March 27, 2026 14:52
Copilot AI review requested due to automatic review settings March 27, 2026 14:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated horizontal scrollbar for Scratch projects in responsive layouts by wrapping the Scratch iframe with OverlayScrollbars and applying targeted styling to keep the scrollbar visible when needed.

Changes:

  • Add overlayscrollbars + overlayscrollbars-react dependencies and wire them into ScratchContainer.
  • Introduce Scratch-specific scrollbar options + SCSS theme to reserve space and keep the horizontal scrollbar visible.
  • Update ScratchContainer tests to mock OverlayScrollbars and assert configuration.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
yarn.lock Locks new OverlayScrollbars dependencies.
package.json Adds overlayscrollbars and overlayscrollbars-react dependencies.
src/components/Editor/Project/ScratchContainer.jsx Wraps the Scratch iframe in OverlayScrollbarsComponent, configures horizontal scrolling, and enforces a min-width.
src/components/Editor/Project/ScratchContainer.test.js Mocks OverlayScrollbars modules and adds assertions for options/configuration.
src/components/Editor/Project/Project.jsx Imports OverlayScrollbars base CSS (in addition to existing CSS imports).
src/assets/stylesheets/ScratchContainer.scss Adds layout + theme styling and scrollbar-space reservation behavior for Scratch viewport.
src/assets/stylesheets/Project.scss Includes ScratchContainer styles and expands theme selectors for #wc contexts.
src/assets/stylesheets/ExternalStyles.scss Injects OverlayScrollbars base CSS into the web-component external stylesheet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Wrap the Scratch iframe in OverlayScrollbars and keep the scrollbar scoped to the Scratch project view.
The bar only appears when the iframe overflows horizontally, keeps a small gutter of its own.
Shortens the iframe when visible so the scrollbar does not sit on top of the editor.
Also add focused tests around the Scratch iframe URL and scrollbar configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants