fix(presetSuggestion): use orientation-aware fallback for non-standard aspect ratios#883
Open
rahul-rajak-nsut wants to merge 3 commits into
Open
Conversation
- Validate width/height in handleWidthChange and handleHeightChange - Reject values outside 16–7680 range and NaN before updating state - Add autoComplete='off' to width and height inputs Fixes magic-peach#24
…d ratios Previously, any video that didn't closely match 9:16, 16:9, or 1:1 always fell back to 'vertical-9-16' (portrait), regardless of actual orientation. A 1440x900 (16:10) landscape video would be suggested a portrait preset. Fix the fallback to check width vs height: - wide videos (width >= height) → 'landscape-16-9' - tall videos (height < width) → 'vertical-9-16' Also updates the test that was encoding the wrong behavior as expected, and adds coverage for 4:3 and 16:10 landscape/portrait inputs. Fixes magic-peach#880
|
@rahul-rajak-nsut is attempting to deploy a commit to the magic-peach1's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
👋 Thanks for your PR, @rahul-rajak-nsut!Welcome to Reframe — a browser-based video editor built for everyone 🎬
What happens next
Quick checklist
Useful links
Happy coding! 🎉 |
Contributor
✅ PR Format Check Passed — @rahul-rajak-nsutBasic format checks passed. A maintainer will review your code changes. This does not mean the PR is approved — it just means the format is correct. |
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.
Description
Fixes a logic bug in
suggestPreset()where the fallback for unrecognised aspect ratios always returned"vertical-9-16"(portrait) regardless of whether the video was actually wide or tall.A single orientation check is added to the fallback:
width >= heightreturns"landscape-16-9", otherwise"vertical-9-16". Common landscape formats like 16:10, 4:3, and 3:2 now correctly suggest a landscape preset instead of portrait.The existing test that was asserting the wrong behavior is also corrected, and two new test cases are added for both landscape and portrait fallback paths.
Related Issue
Closes #880
Type of Contribution
Participant Info
Screen Recording
Not applicable — this PR contains no UI or visual changes. The fix is entirely within a pure TypeScript utility function (
src/lib/presetSuggestion.ts) and its test file. No component, style, or DOM element was modified.Changes made
src/lib/presetSuggestion.ts— one-line fix:src/lib/tests/presetSuggestion.test.ts— fixed the wrong test, added coverage:Checklist
bun run lintpasses (no ESLint errors)bunx tsc --noEmitpasses (no TypeScript errors)aria-label/ accessible names — N/A, no UI changesconsole.logstatements left in