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

Add isComposing check to EditableText toggleEdit #7021

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

natsuozawa
Copy link
Member

Checklist

  • Includes tests (no need for update)
  • Update documentation (no need for update)

Changes proposed in this pull request:

EditableText will check that the user is not composing before sending out onConfirm event.
This is necessary because in some IMEs, such as Japanese, users will press Enter to convert text (ie from hiragana to kanji). In these cases, we don't want EditableText to exit from editing mode.

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing

Reviewers should focus on:

Screenshot

@changelog-app
Copy link

changelog-app bot commented Oct 21, 2024

Generate changelog in packages/core/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add isComposing check to EditableText toggleEdit

Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

Fix isComposing check

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

ggdouglas
ggdouglas previously approved these changes Oct 22, 2024
@ggdouglas
Copy link
Contributor

ggdouglas commented Oct 22, 2024

Hey @natsuozawa, thanks for the PR. This looks good to me as far as preserving existing functionality, but I don't have ready access to a Japanese keyboard to test the added functionality here. I'll assume that you have verified these changes locally. Is there any way we can add a test in code as well?

@@ -357,7 +357,7 @@ export class EditableText extends AbstractPureComponent<EditableTextProps, Edita
}

const hasModifierKey = altKey || ctrlKey || metaKey || shiftKey;
if (event.key === "Enter") {
if (event.key === "Enter" && !event.nativeEvent.isComposing) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we actually need to do this earlier, before we handle escape. Normally, at least on macOS, pressing escape while composing cancels the current sequence. Both with and without this change, it cancels the entire edit, i.e. everything that was changed will be abandoned, instead of just the current sequence discarded and other changes and editing mode preserved.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey you're right that maybe we should not escape when the IME is composing, but in my understanding people don't usually press escape during typing. Personally, I would expect to escape even when composing

@ggdouglas ggdouglas dismissed their stale review October 22, 2024 18:01

Additional change requested by @invliD

@natsuozawa natsuozawa merged commit ee26faf into develop Oct 23, 2024
12 of 14 checks passed
@natsuozawa natsuozawa deleted the nozawa/editable-text-is-composing-check branch October 23, 2024 04:34
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.

4 participants