Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces the avatar zoom MUI Slider with a native range input and removes its dependency subtree.
Changes:
- Adds native range handling and vendor-specific styling.
- Adds an interaction test.
- Removes MUI/Emotion dependencies and lockfile entries.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
PageAvatar/index.tsx |
Implements the native zoom slider. |
PageAvatar/index.test.tsx |
Tests slider accessibility and updates. |
package.json |
Removes obsolete dependencies. |
yarn.lock |
Removes associated dependency trees. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+248
to
+249
| <input | ||
| type="range" |
Comment on lines
+208
to
+210
| await act(async () => { | ||
| fireEvent.change(slider, { target: { value: '2.5' } }); | ||
| }); |
- The leftover `slider.css` clipped the new zoom control to nothing. Its `.AvatarCropper input` rule set `clip: rect(0,0,0,0)` and `position: absolute` to hide MUI's proxy input, and the native `<input type="range">` sits inside the same `.AvatarCropper` container, so the rule matched it too. - The zoom test drove the control with `fireEvent.change`, which only proves a synthetic value assignment. `.claude/rules/testing/react.md` asks for `userEvent`. - Deletes `slider.css` and its `@import` from `tailwind.css`. Every selector in the file was `.AvatarCropper` or `.MuiSlider-*`, and only `PageAvatar/index.tsx` uses `.AvatarCropper`. - Rewrites the zoom test in `PageAvatar/index.test.tsx` to use `userEvent.setup()`, with `user.upload()` for the file input and a `user.click()` on `zoom-in-btn` that drives the slider value to `1.1`. - Keeps one `fireEvent.change` for the thumb move, with a comment. jsdom implements no default action for a range input, so neither a pointer drag nor an arrow key moves the thumb. Closes: https://mozilla-hub.atlassian.net/browse/FXA-10214
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.
Because
slider.cssclipped the new zoom control to nothing. Its.AvatarCropper inputrule setclip: rect(0,0,0,0)andposition: absoluteto hide MUI's proxy input, and the native<input type="range">sits inside the same.AvatarCroppercontainer, so the rule matched it too.fireEvent.change, which only proves a synthetic value assignment..claude/rules/testing/react.mdasks foruserEvent.This pull request
slider.cssand its@importfromtailwind.css. Every selector in the file was.AvatarCropperor.MuiSlider-*, and onlyPageAvatar/index.tsxuses.AvatarCropper.PageAvatar/index.test.tsxto useuserEvent.setup(), withuser.upload()for the file input and auser.click()onzoom-in-btnthat drives the slider value to1.1.fireEvent.changefor the thumb move, with a comment. jsdom implements no default action for a range input, so neither a pointer drag nor an arrow key moves the thumb.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-10214
Checklist
Put an
xin the boxes that applyHow to review (Optional)
packages/fxa-settings/src/styles/slider.css, and the zoom test inPageAvatar/index.test.tsx.Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
Two calls for the reviewer. Both come from the parent commit, not this diff, so I left them alone.
The thumb is
w-4 h-4, so 16px. MUI's was 24px, and WCAG 2.5.8 asks for 24x24. The fix isw-6 h-6on both vendor thumb selectors plus an explicith-6on the input. Worth doing before merge if you want the old touch target back.The deleted rule also carried
direction: ltr. A native range input follows page direction instead, so the zoom control now reverses in RTL locales. That is the browser default and probably what we want, but it is a change and nothing here checks it.Local results:
node scripts/test.js --testPathPattern PageAvatar12 passed, 0 failed.npx eslint .infxa-settingsexits 0.tsc --noEmitclean.