Repository navigation
feat: put the video back when the tab comes back, undoing auto-PiP - #4
Merged
Merged
Conversation
New setting `autoRestoreOnTabReturn`: when the tab becomes visible again, a video that *this extension* floated on the last tab hide leaves PiP and goes back where it came from. **On by default, while `autoPipOnTabHide` stays off** — coherent only because nothing is ever remembered while the parent is off, so this can do nothing until the user switches that on. It is a shape rather than a behaviour: it says what auto-PiP means for whoever turns it on without reading further. The rule the two defaults satisfy together is that no window moves before the user has asked for anything. The control is `disabled` while the parent is off, in `options.html` as well as in `render` — not unchecked, which would misreport what is stored, and not hidden, which would make the feature undiscoverable exactly where somebody is reading about it. RRR §4.6 previously ruled restoring on return out, and its objection — the user may have deliberately kept the window floating — is answered inside the setting's own definition rather than waived. Two conditions, each with its own test: the video must be one we floated, and it must have been in PiP continuously since, judged by the browser's presentation reports (`onModeChange`) and not by the mode read on return. Those differ exactly when the user takes the window out and puts it back by hand: same mode, opposite intent. Deleting the subscription leaves 50 of 52 auto-PiP tests green. Exit is `togglePiP`, the call the hotkey makes, so "back where it came from" includes BF19's document fullscreen — which Safari will usually refuse for want of a user gesture. Accepted and documented in the options page and the README rather than suppressed: inline is where the user lands either way. 491 tests (was 471); `dist/content.js` 8050 → 8259 B of 12288 (RRR §5.2). Decisions 318–325. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MruXVD9WM1YTATWgftepZW
artginzburg
force-pushed
the
claude/video-pip-restore-state-t14l12
branch
from
August 5, 2026 01:51
3723b16 to
80a87ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New setting
autoRestoreOnTabReturn("Put it back when you return to the tab"): when the tab becomes visible again, a video that this extension floated on the last tab hide leaves PiP and goes back where it came from.The two defaults, which disagree on purpose
autoRestoreOnTabReturnis on,autoPipOnTabHidestays off. That is coherent only because nothing is ever remembered while the parent is off, so the child can do nothing until the user switches the parent on — it is a shape rather than a behaviour: it says what auto-PiP means for whoever turns it on without reading further. The rule the two satisfy together is that no window moves before the user has asked for anything, and it holds: the return half is consulted only for a video this binding floated, and floating one requires the parent.The control is
disabledwhile the parent is off — inoptions.htmlas well as inrender, since the markup is the page for the moment before the bundle runs. Not unchecked, which would misreport what is stored; not hidden, which would make the feature undiscoverable exactly where somebody is reading about it. Same principle as RRR §4.3's access read-out being a marker rather than a button.Why this is a setting and not a behaviour
RRR §4.6 ruled restoring on return out, and its objection still stands — the user may have deliberately kept the window floating. What makes the option legitimate is that the objection is answered inside the option's own definition. Two conditions, each with its own test:
The second is judged by the browser's own presentation reports (
PresentationController.onModeChange, BF02's fourth member), not by the mode read on return. Those differ exactly when the user takes the window out and puts it back by hand: same mode, opposite intent. Mutation check: deleting the subscription and keeping a live-mode check leaves 50 of 52 auto-PiP tests green, and the one it breaks is that case.Notes worth a reviewer's attention
togglePiP, the call the hotkey makes — notsetMode(INLINE). So "back where it came from" includes BF19's document fullscreen, from one existing function rather than a second answer that can drift. Symmetric with DECISIONS 174, which routed the entry the same way.requestFullscreenneeds a user gesture and returning to a tab is not one, so that half of the restore is refused and swallowed. Documented in the options page and the README rather than suppressed — inline is where the user lands either way, and suppressing the request would exclude a future Safari that allows it.visibilityState === 'visible'/=== 'hidden'as named states, so a prerendered document is neither.Verification
tscclean on both projects, prettier clean.dist/content.js8050 → 8259 B of 12288 (RRR §5.2), 67%.xcodebuild. This was a Linux cloud session, so the Xcode half ofmake check(project,app-build,entitlements) has not been executed — CI's macOS job covers it, and no new source files were added, soproject.yml'sinputFileslist is unchanged.make applocally is the only instrument for that.Records: RRR §3 and §4.6 amended, DECISIONS 318–325 (with 323a/323b for the defaults), PLAN T22, README, ARCHITECTURE module map.