detached cc823ac

feat(port): add popup window support types and callbacks

Adds PopupRequest type, OnCreate/OnReadyToShow callbacks to WebViewCallbacks, and CreateRelated factory method to WebViewFactory interface. These enable popup window handling with shared session/cookie state.
commit
cc823acbcd11821553efae186b9201bb94bf9213
author
bnema · · 2025-12-09 22:57 UTC
parent
25b2387
signature
unsigned
1 file · +18 -0
M internal/application/port/webview.go +18 -0
@@ -52,6 +52,14 @@ type WebViewState struct {
5252 ZoomLevel float64
5353 }
5454
55+// PopupRequest contains metadata about a popup window request.
56+type PopupRequest struct {
57+ TargetURI string
58+ FrameName string // e.g., "_blank", custom name, or empty
59+ IsUserGesture bool
60+ ParentViewID WebViewID
61+}
62+
5563 // WebViewCallbacks defines callback handlers for WebView events.
5664 // Implementations should invoke these on the main thread/goroutine.
5765 type WebViewCallbacks struct {
@@ -65,6 +73,11 @@ type WebViewCallbacks struct {
6573 OnProgressChanged func(progress float64)
6674 // OnClose is called when the WebView requests to close.
6775 OnClose func()
76+ // OnCreate is called when a popup window is requested.
77+ // Return a WebView to allow the popup, or nil to block it.
78+ OnCreate func(request PopupRequest) WebView
79+ // OnReadyToShow is called when a popup WebView is ready to display.
80+ OnReadyToShow func()
6881 }
6982
7083 // WebView defines the port interface for browser view operations.
@@ -175,4 +188,9 @@ type WebViewPool interface {
175188 type WebViewFactory interface {
176189 // Create creates a new WebView instance.
177190 Create(ctx context.Context) (WebView, error)
191+
192+ // CreateRelated creates a WebView that shares session/cookies with parent.
193+ // This is required for popup windows to maintain authentication state.
194+ // Popup WebViews bypass the pool since they must be related to a specific parent.
195+ CreateRelated(ctx context.Context, parentID WebViewID) (WebView, error)
178196 }
@@ -52,6 +52,14 @@ type WebViewState struct {
52 ZoomLevel float6452 ZoomLevel float64
53 }53 }
54 54
55+// PopupRequest contains metadata about a popup window request.
56+type PopupRequest struct {
57+ TargetURI string
58+ FrameName string // e.g., "_blank", custom name, or empty
59+ IsUserGesture bool
60+ ParentViewID WebViewID
61+}
62+
55 // WebViewCallbacks defines callback handlers for WebView events.63 // WebViewCallbacks defines callback handlers for WebView events.
56 // Implementations should invoke these on the main thread/goroutine.64 // Implementations should invoke these on the main thread/goroutine.
57 type WebViewCallbacks struct {65 type WebViewCallbacks struct {
@@ -65,6 +73,11 @@ type WebViewCallbacks struct {
65 OnProgressChanged func(progress float64)73 OnProgressChanged func(progress float64)
66 // OnClose is called when the WebView requests to close.74 // OnClose is called when the WebView requests to close.
67 OnClose func()75 OnClose func()
76+ // OnCreate is called when a popup window is requested.
77+ // Return a WebView to allow the popup, or nil to block it.
78+ OnCreate func(request PopupRequest) WebView
79+ // OnReadyToShow is called when a popup WebView is ready to display.
80+ OnReadyToShow func()
68 }81 }
69 82
70 // WebView defines the port interface for browser view operations.83 // WebView defines the port interface for browser view operations.
@@ -175,4 +188,9 @@ type WebViewPool interface {
175 type WebViewFactory interface {188 type WebViewFactory interface {
176 // Create creates a new WebView instance.189 // Create creates a new WebView instance.
177 Create(ctx context.Context) (WebView, error)190 Create(ctx context.Context) (WebView, error)
191+
192+ // CreateRelated creates a WebView that shares session/cookies with parent.
193+ // This is required for popup windows to maintain authentication state.
194+ // Popup WebViews bypass the pool since they must be related to a specific parent.
195+ CreateRelated(ctx context.Context, parentID WebViewID) (WebView, error)
178 }196 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close