-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Rich text: remove placeholder on composition start #41970
Conversation
Size Change: +29 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a comment in line 71 or the source stating Safari doesn't support isComposing
, but I believe that's only for the InputEvent
, since it works for KeyboardEvent
. Not necessary for this PR, but I found it slightly confusing when trying to understand the code and the change.
This looks great and I don't see an easy way in which it will break. Did you have any reluctance holding it as a draft? (I'm approving even though it's a draft, which you are free to ignore and I didn't mean to jump in too quickly on it).
// during composition, the placeholder doesn't get removed. There's | ||
// no need to re-add it, when the value is updated on compositionend | ||
// it will be re-added when the value is empty. | ||
element.querySelector( `[${ PLACEHOLDER_ATTR_NAME }]` ).remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems quite elegant and works for the input cases I tested, namely Japanese entry and Kanji selection.
e98f5c2
to
37d5208
Compare
Right, so we're storing
No, it just seems like Github made that the default now and I didn't check. |
What?
When composing characters in rich text, the placeholder remains in place because the rich text value doesn't update internally. We can't update the value internally because that would destroy the state of composition set by the browser (because we modify the dom). So the only option we have is to remove it from the dom on composition start. An ugly solution, but can't think of another way right now.
Why?
How?
Testing Instructions
Screenshots or screencast