Skip to content

feat(browser): device-mode viewports and keyboard shortcuts - #11

Merged
ElVatoEste merged 1 commit into
mainfrom
feat/viewports-shortcuts
Aug 21, 2026
Merged

feat(browser): device-mode viewports and keyboard shortcuts#11
ElVatoEste merged 1 commit into
mainfrom
feat/viewports-shortcuts

Conversation

@ElVatoEste

Copy link
Copy Markdown
Member

Qué

Dos features de v1.

Viewports / device modes (REQ-025)

  • Catálogo de presets: iPhone SE/14 Pro, Pixel 7, iPad Mini/Pro, Laptop, Desktop HD + ajustar a ventana + custom W×H.
  • Redimensiona la WebContentsView de la página activa al box del device (centrado bajo el chrome) y aplica CDP Emulation en la pestaña activa: setDeviceMetricsOverride (DPR, mobile), setTouchEmulationEnabled, setUserAgentOverride (UA móvil en presets touch).
  • La emulación sigue a la pestaña activa y se re-aplica tras una navegación completa (que resetea los overrides).
  • Swap portrait/landscape + aviso de recorte cuando el box excede la ventana (Chromium no escala la superficie → los presets grandes topan al tamaño de ventana).
  • Nuevo selector ViewportChip en la toolbar (reemplaza el chip estático de resolución); reusa chromeExpand para que el menú flote sobre la página.

Atajos de teclado (REQ-026)

Vía before-input-event en chrome, overlay y cada página → responden con el foco donde sea.

Atajo Acción
Ctrl+R / F5 Recargar
Ctrl+Shift+R Recargar sin cache
Ctrl+T Nueva pestaña
Ctrl+W Cerrar pestaña
Ctrl+Tab / Ctrl+Shift+Tab Ciclar pestañas
Ctrl+18 / Ctrl+9 Ir a pestaña N / última
Ctrl+L / Alt+D Enfocar barra de direcciones
Ctrl+D Bookmark on/off
Ctrl+B Barra de bookmarks
Ctrl+Shift+O Overlay observability
Ctrl+P Imprimir página

Verificación

  • npm run typecheck
  • npm run build

Pendiente (follow-up)

  • Ctrl+F find-in-page (necesita find bar propia + webContents.findInPage).

Viewports / device modes (REQ-025):
- Add DevicePreset catalog (iPhone SE/14 Pro, Pixel 7, iPad Mini/Pro,
  Laptop, Desktop HD) plus fit-to-window and custom W×H in shared events.
- Resize the active page WebContentsView to the selected device box,
  centered under the chrome, and drive CDP Emulation on the active tab:
  setDeviceMetricsOverride (DPR, mobile), setTouchEmulationEnabled, and
  setUserAgentOverride for mobile presets. Emulation follows the active
  tab and is re-applied after a full navigation resets the overrides.
- Portrait/landscape swap and a clamp warning when the box exceeds the
  window (Chromium cannot scale the surface, so oversized presets cap
  at the window size).
- New ViewportChip selector in the toolbar replaces the static
  resolution chip; reuses chromeExpand so its menu floats over the page.

Keyboard shortcuts (REQ-026), via before-input-event on chrome, overlay
and every page webContents so they fire regardless of focus:
- Ctrl+R / F5 reload, Ctrl+Shift+R hard reload
- Ctrl+T new tab, Ctrl+W close tab, Ctrl+Tab / Ctrl+Shift+Tab cycle,
  Ctrl+1-8 select tab, Ctrl+9 last tab
- Ctrl+L / Alt+D focus address bar (main → chrome focusAddress channel)
- Ctrl+D bookmark toggle, Ctrl+B bookmarks bar, Ctrl+Shift+O overlay,
  Ctrl+P print active page
@ElVatoEste
ElVatoEste merged commit e6ef6bc into main Aug 21, 2026
1 check passed
@ElVatoEste
ElVatoEste deleted the feat/viewports-shortcuts branch August 21, 2026 06:09
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.

1 participant