Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Android IME behavior requires device validation, and key handler branches need stronger tests.
Pull request overview
Improves password-form keyboard behavior and Android IME hints.
Changes:
- Forwards
enterKeyHintandonKeyDownthrough password inputs. - Advances Enter focus to confirmation while preserving IME composition.
- Adds component tests and injectable form submission mocks.
File summaries
| File | Description |
|---|---|
packages/fxa-settings/src/components/InputText/index.tsx |
Adds keyboard hint and handler props. |
packages/fxa-settings/src/components/InputText/index.test.tsx |
Tests the new props. |
packages/fxa-settings/src/components/InputPassword/index.tsx |
Forwards the new input props. |
packages/fxa-settings/src/components/InputPassword/index.test.tsx |
Tests prop forwarding. |
packages/fxa-settings/src/components/FormPasswordWithInlineCriteria/mocks.tsx |
Supports injected submit handlers. |
packages/fxa-settings/src/components/FormPasswordWithInlineCriteria/index.tsx |
Adds focus advancement and IME handling. |
packages/fxa-settings/src/components/FormPasswordWithInlineCriteria/index.test.tsx |
Tests hints and Enter behavior. |
Review details
Suppressed comments (2)
packages/fxa-settings/src/components/InputText/index.test.tsx:74
- This ordinary keyboard interaction uses
fireEvent, which bypasses the real focus/input/keydown sequence. The component-test convention in.claude/rules/testing/react.md:36-49requiresuserEventhere; make the test async, target the input by its label, and send Enter withuserEvent(unlike the IME test, this case does not need a syntheticisComposingvalue).
fireEvent.keyDown(screen.getByTestId('input-field'), { key: 'Enter' });
packages/fxa-settings/src/components/InputPassword/index.test.tsx:63
- This ordinary keyboard interaction uses
fireEvent, which bypasses the real focus/input/keydown sequence. The component-test convention in.claude/rules/testing/react.md:36-49requiresuserEventhere; make the test async, target the input by its label, and send Enter withuserEvent(unlike the IME test, this case does not need a syntheticisComposingvalue).
fireEvent.keyDown(screen.getByTestId('input-field'), { key: 'Enter' });
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
## Because - On Android, the keyboard showed "Go" on the new password field. The key did nothing, because the submit button stays disabled until the form is valid. - Enter in the new password field did not move the user to the confirm field. ## This pull request - Adds `enterKeyHint` and `onKeyDown` props to `InputText`, and forwards both through `InputPassword`. - Sets `enterKeyHint="next"` on the new password field when the confirm field renders, and `"done"` when it does not. - Sets `enterKeyHint="done"` and a DOM ref on the confirm field in `FormPasswordWithInlineCriteria`. - Adds an `onKeyDown` handler. On Enter it moves focus to the confirm field and does not submit the form. Some browsers ignore `enterKeyHint`, so the label alone is not enough. - Ignores the Enter key that ends an IME composition. The input method keeps that key. ## Issue that this pull request solves Closes: https://mozilla-hub.atlassian.net/browse/FXA-12595
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
This pull request
enterKeyHintandonKeyDownprops toInputText, and forwards both throughInputPassword.enterKeyHint="next"on the new password field when the confirm field renders, and"done"when it does not.enterKeyHint="done"and a DOM ref on the confirm field inFormPasswordWithInlineCriteria.onKeyDownhandler. On Enter it moves focus to the confirm field and does not submit the form. Some browsers ignoreenterKeyHint, so the label alone is not enough.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-12595
Checklist
Put an
xin the boxes that applyHow to review (Optional)
onNewPwdKeyDownhandler and the confirm field ref inFormPasswordWithInlineCriteria/index.tsx. The two new props inInputText/index.tsxare pass-through only.InputText, thenInputPassword, thenFormPasswordWithInlineCriteria, then the tests.event.nativeEvent.isComposing.userEventcannot set that flag, so that test usesfireEventand asserts on the return value.Screenshots (Optional)
No screenshots. The change is not visible on desktop. Only the label on the mobile soft keyboard changes.
Other information (Optional)
Local results:
InputText,InputPasswordandFormPasswordWithInlineCriteriatest files: 25 passed, 0 failed.nx lint fxa-settings: exit 0.The Playwright functional tests did not run here. CI runs them.
Review round one asked for two more tests. This branch now checks that Enter still submits the signup form, which has no confirm field, and that the composing Enter is not cancelled.