Repository navigation
iPad held sideways: a 馃摉 button for the book layout - #264
Merged
Merged
Conversation
An iPad has no fold, so the foldable book layout never applied. Held sideways (900px+ wide), the menu now ends with 馃摉, which lays the site out as a book like iPhone Duo or a foldable in book: the menu on the left page, reading on the right, the spine down the middle, pages turning. - utils/foldMode.mjs: iPads (a "Mac" with touch) held sideways are data-device="ipad"; with the book chosen, data-fold="book" and the spine vars. The choice is kept in localStorage and read before paint. The iPhone Duo open-flat rule now names iPhone Duo only. - components/BookToggle.vue in the menu (aria-pressed), shown only on data-device="ipad" - Unit tests for the rules and the head script; browser tests for the toggle, keeping the choice, turning upright and back, page turns, and no button on a Mac or any phone or foldable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nginuw5wmUjUSkmQB1J3pS
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.
Summary
On an iPad held sideways, the menu now ends with a 馃摉 button at its top-right corner. It turns on the same book layout iPhone Duo and foldables get when folded down the middle:
Tapping 馃摉 again turns it off. The choice is remembered, so the next visit opens as a book.
Related Issue
None. Requested directly, with a screenshot of the iPad layout: "Add book icon on ipad in landscape mode to allow the book feature on ipad layout similar to iPhone Duo".
Changes Made
utils/foldMode.mjs:maxTouchPoints0.data-device="ipad". A narrow Split View or Stage Manager window doesn't qualify.data-fold="book", with the spine in the middle and 24px kept clear either side. All the existing book styles, the page turns and the corner pager apply as they are.localStorage(book:chosen). The page-head script reads it before the first paint, so there's no flash of the usual layout.bookchangeevent, and the page re-lays out live.components/BookToggle.vue:aria-pressedshowing the state.data-device="ipad".tests/app/fold-mode.test.mjs: iPad sideways with and without the book, upright, narrow windows, and the choice meaning nothing on a Mac, an iPhone Duo or an Android tablet. Also the page-head script itself running as an iPad (opens as a book, toggles off and on).tests/e2e/foldable.spec.mjs, with an iPad Air size and Safari's Mac user agent:How to Test
npm test: 282 pass.npm run generate.PLAYWRIGHT_CHROMIUM_PATH=/opt/pw-browsers/chromium npx playwright test tests/e2e/foldable.spec.mjs -g "iPad|Mac|no other device": 106 passed, the rest skipped by design.Additional Notes
Generated by Claude Code