Skip to content

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Prevent runtime errors when the app is embedded or served as standalone pages that lack editor DOM elements like codePanel or maincontent.
  • Make UI initialization and view toggling robust on narrow/wide screens and in PWA/fullscreen contexts.
  • Ensure canvas resizing and play/design mode flows do nothing when required UI elements are absent to avoid null dereferences.

Description

  • Add null checks for DOM lookups in resizeCanvas, switchView, showCodeView, showCanvasView, togglePlayMode, addButtonListener, addSwipeListeners, setupViewObserver, and initializeUI and return early when required elements are missing.
  • Guard accesses to optional elements such as gizmoButtons, fullscreenToggle, switchViewsBtn, bottomBar, flocklink, and maincontent before modifying styles or text content.
  • Replace some transform-based view switching with DOM-based show/hide logic and ensure Blockly.svgResize is called only when workspace is present.
  • Keep existing behavior for narrow/wide screen flows while making all UI-only operations safe on pages without the editor containers.

Testing

  • No automated tests were run for this change.

Codex Task

@tracygardner tracygardner deleted the codex/investigate-cubeart.html-errors branch January 18, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants