Skip to content

fix: make SortBy control responsive on mobile#2142

Merged
DonKoko merged 4 commits intomainfrom
codex/fix-click-issue-in-assets-sorted-by-field
Oct 27, 2025
Merged

fix: make SortBy control responsive on mobile#2142
DonKoko merged 4 commits intomainfrom
codex/fix-click-issue-in-assets-sorted-by-field

Conversation

@carlosvirreira
Copy link
Copy Markdown
Contributor

Summary

  • render the SortBy selects inline on mobile viewports to avoid the Radix popover trap
  • keep both selects controlled so search params stay in sync across views
  • add tests covering the mobile inline experience and desktop popover trigger
  • explicitly note that Playwright coverage remains out of scope per CTO guidance

Testing

  • npm run test -- sort-by

https://chatgpt.com/codex/tasks/task_b_68f8e2ed58208326b78fdd7f1dea307c

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Preview Oct 27, 2025 0:26am

Copy link
Copy Markdown
Contributor

@DonKoko DonKoko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR doesn't exactly fix the existing bug, but rather completely replaces the sort by functionality on mobile.
A few things:

  1. This new design basically takes half the screen which I don't think is good.

Before:
IMG_FBEB5212B268-1

After:
Nikolay's inventory  shelf nu

  1. The way this is implemented is very strange. You are changing both select elements to "controlled", but not really as there is no state, they are controlled by the search params. If that is the approach they should just be kept as uncontrolled. Moreover this doesn't seem to be related to the resolution of the issue as the issue was defined as something happening because of the Popover focus on mobile, and that popover is removed so this seems necessary

  2. The code is quite messy and hard to understand. If it is really required to use a different component for mobile, it should be abstracted into its own file and everything should be kept clean and easy to understand and maintain

  3. The tests have a lot of issues with them. They are not testing the actual code but rather testing the mocks. The actual important validations and behaviors of the component are not tested. IMO those tests are basically useless.

carlosvirreira and others added 3 commits October 24, 2025 15:43
Replace implementation-detail testing with user-facing behavior tests:
- Remove test for preventDefault call (implementation detail)
- Remove assertions inside mock implementations
- Add coverage for URL param validation logic
- Add tests for orderDirection select (was missing)
- Add tests for disabled state during navigation
- Test preservation of other URL params

Simplify mocking strategy:
- Remove complex Radix mock that captured focus events
- Use minimal Radix mock only to render content in JSDOM
- All mocks have clear "why:" justification comments
- No internal business logic is mocked

Improve test organization:
- Group tests by concern (initialization, interactions, disabled state, edge cases)
- Clear, descriptive test names focused on observable behavior
- Tests verify actual outcomes users care about

All 14 tests pass and follow CLAUDE.md testing guidelines.
@DonKoko DonKoko merged commit 49acc0f into main Oct 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants