Skip to content

Rename morpheme-editor Reset string key; test store hooks directly - #175

Merged
alex-rawlings-yyc merged 3 commits into
improve-morph-break-uifrom
imbu2
Jul 28, 2026
Merged

Rename morpheme-editor Reset string key; test store hooks directly#175
alex-rawlings-yyc merged 3 commits into
improve-morph-break-uifrom
imbu2

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Three small, independent changes on top of improve-morph-break-ui:

  • Fix: reopen the morpheme editor from any breakdown cell. The forms row renders the first morpheme as a <button> and the rest as presentational <span>s; only the button canceled the click's default action. Inside TokenChip's <label>, clicking a later cell was forwarded to the token gloss input, and that focus landed outside the just-opened modal editor and dismissed it — so only the first cell reopened the editor. Now every form cell cancels the default action. jsdom doesn't reproduce label focus-forwarding (and the TokenChip integration test stubs MorphemeBox), so the regression test asserts the preventDefault that suppresses it in a real browser.
  • Rename the morpheme-editor "Reset" string key from %interlinearizer_morphemeEditor_delete% to %interlinearizer_morphemeEditor_reset%, and update the TokenChip doc wording. The button is labeled "Reset" and resets the breakdown rather than deleting it, so the key name now matches the label and behavior.
  • Test AnalysisStore dispatch hooks directly via renderHook instead of throwaway button-and-click components. Adds a shared renderStoreHook wrapper, drives dispatchers inside act(...), and asserts on result.current. Rendered components are kept only where the DOM is genuinely needed (re-render / render-count assertions, mount/unmount lifecycle). Documented the convention in AGENTS.md.

🤖 Generated with Claude Code


This change is Reviewable

imnasnainaec and others added 2 commits July 28, 2026 09:24
The button labeled "Reset" and its behavior reset the morpheme breakdown
rather than deleting it; align the localized string key and doc wording.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the throwaway button-and-click components in the dispatch tests
with renderHook + a shared renderStoreHook wrapper, calling dispatchers
inside act and asserting on result.current. Document the convention in
AGENTS.md. Rendered components are kept only where the DOM is essential
(re-render counts, mount/unmount lifecycle).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 74d78007-ab2d-4e43-8c70-945e3c7daa18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch imbu2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imnasnainaec
imnasnainaec marked this pull request as ready for review July 28, 2026 13:31
@imnasnainaec
imnasnainaec marked this pull request as draft July 28, 2026 13:59
The forms row renders the first morpheme as a <button> but the rest as
presentational <span>s. Only the button canceled the click's default
action, so inside TokenChip's <label> a click on a later cell was
forwarded to the token gloss input; that focus landed outside the
just-opened modal editor and immediately dismissed it, leaving focus on
the first morpheme gloss field instead of reopening the editor.

Cancel the default action on every form cell. jsdom doesn't reproduce
label focus-forwarding (so the TokenChip integration test, which stubs
MorphemeBox, never caught it); the regression test asserts the
preventDefault that suppresses it in a real browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@imnasnainaec
imnasnainaec marked this pull request as ready for review July 28, 2026 14:16

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@alex-rawlings-yyc reviewed 8 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@alex-rawlings-yyc
alex-rawlings-yyc merged commit f971b89 into improve-morph-break-ui Jul 28, 2026
2 checks passed
@alex-rawlings-yyc
alex-rawlings-yyc deleted the imbu2 branch July 28, 2026 14:57
alex-rawlings-yyc added a commit that referenced this pull request Jul 28, 2026
…he bare surface form (#173)

* Make morpheme-break reset explicit; confirm before losing glosses

* Dismiss morpheme popover on outside click with an empty draft

handleSave returns early on an empty draft without closing, so an
outside
click after clearing the input left the modal popover stuck open.

* Use platform Input/Label in the morpheme popover

PR #168 migrated this popover's buttons to platform-bible-react `Button`
but left the breakdown text field and its label as raw HTML. Bring them
in line with the convention the three project modals already follow, so
the field picks up the host's focus ring, disabled styling, and dark-mode
tokens instead of the hand-rolled approximations.

Drops the classes `Input` already supplies (rounded, border, border-input,
px/py, text-sm) and keeps only `w-full` and the `font-mono` that the
morpheme forms want. `Label` defaults to text-sm, so the popover's
smaller `text-xs` stays as an explicit override.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Rename morpheme-editor Reset string key; test store hooks directly (#175)

* Rename morpheme-editor Reset string key from delete to reset

The button labeled "Reset" and its behavior reset the morpheme breakdown
rather than deleting it; align the localized string key and doc wording.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Test AnalysisStore hooks directly via renderHook

Replace the throwaway button-and-click components in the dispatch tests
with renderHook + a shared renderStoreHook wrapper, calling dispatchers
inside act and asserting on result.current. Document the convention in
AGENTS.md. Rendered components are kept only where the DOM is essential
(re-render counts, mount/unmount lifecycle).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Reopen the morpheme editor when any breakdown cell is clicked

The forms row renders the first morpheme as a <button> but the rest as
presentational <span>s. Only the button canceled the click's default
action, so inside TokenChip's <label> a click on a later cell was
forwarded to the token gloss input; that focus landed outside the
just-opened modal editor and immediately dismissed it, leaving focus on
the first morpheme gloss field instead of reopening the editor.

Cancel the default action on every form cell. jsdom doesn't reproduce
label focus-forwarding (so the TokenChip integration test, which stubs
MorphemeBox, never caught it); the regression test asserts the
preventDefault that suppresses it in a real browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: D. Ror. <imnasnainaec@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants