Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(comments): refactor how input and focus is handled #5068

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

skogsmaskin
Copy link
Member

@skogsmaskin skogsmaskin commented Oct 25, 2023

Description

  • Enter will submit the comment
  • Input field is reset after submission or discard
  • Setting focus is handled through the same function everywhere.
  • Input key events are propagated to the parent components

Also made a performance optimization making sure the thread isn't re-rendered whenever there is a new value in the CommenListItem input.

Also added a test for comment submission.

What to review

Notes for release

@vercel
Copy link

vercel bot commented Oct 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Oct 26, 2023 0:43am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 26, 2023 0:43am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Oct 26, 2023 0:43am

@skogsmaskin skogsmaskin marked this pull request as ready for review October 25, 2023 13:35
@github-actions
Copy link
Contributor

No changes to documentation

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2023

Component Testing Report Updated Oct 26, 2023 12:45 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 23s 12 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 5s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 11s 3 0 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 11s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 30s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 14s 9 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 50s 18 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 7s 3 0 0

* Enter will submit the comment
* Input field is reset after submission or discard
* Setting focus is handled through the same function everywhere.
…and consumers

This will let comment input key events propagate to the parent components for
handling spesific functionality for that parent.

This also reduces the need for additional key handlers in the parent components,
and makes it easier to compose functionality as there is only one originating source
of those events.
Copy link
Member

@hermanwikner hermanwikner left a comment

Choose a reason for hiding this comment

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

Great stuff @skogsmaskin 🙏

@skogsmaskin skogsmaskin merged commit 6d1392f into feat/comments-mvi-1 Oct 26, 2023
21 checks passed
@skogsmaskin skogsmaskin deleted the edx-671 branch October 26, 2023 13:08
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