-
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: Add missing keep placeholder on focus prop. #17439
Rich Text: Add missing keep placeholder on focus prop. #17439
Conversation
@@ -336,6 +336,7 @@ class RichTextWrapper extends Component { | |||
didAutomaticChange, | |||
undo, | |||
placeholder, | |||
keepPlaceholderOnFocus, |
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.
Should we include the deprecation message?
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.
We are not actually deprecating this one.
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.
We need to restore documentation then.
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.
display: none; | ||
&.is-selected { | ||
&.keep-placeholder-on-focus [data-rich-text-placeholder] { | ||
pointer-events: none; |
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.
Will it display a different cursor icon? I guess, it still needs to be overridden.
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.
It shows the same one for me.
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.
Why does this rule need to be added? Is the one above not enough on :after
?
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.
It's needed so that you can select/see the caret through the placeholder.
Fixed #16733 (comment) in 37e6fab. |
… on the span instead of on the pseudo element
I see one small issue: when the placeholder is kept on focus and you click on it, there is no caret visible. You can still type though. I see that the browser selection is somewhere after the placeholder, so we could enforce selection to be in the placeholder text element. Let's look at this separately. |
Sounds good, thanks for taking a look at this! |
This was also noted on #16733 (comment) When |
I'm a bit confused. If the placeholder (the span element) is not clickable, how can the click happen on the span element? I think the placeholder should be ignored/"invisible" for clicks, and instead fall in the parent element. I'll have a look to fix this. In the meantime it might be worth creating a separate tracking issue for it. |
Language barriers 🙂 I mean it's not possible to click the field because the |
Yes, it should be fixed by this PR right? |
The only remaining issue I see is that the caret is hidden after the placeholder is clicked. It seems to be positioned after the placeholder instead of the text node before. |
Btw, this seems to work fine in Safari. In Chrome the caret becomes invisible. |
Closes #17405
Description
This PR fixes backwards compatibility issues that came with the unintentional removal of the
keepPlaceholderOnFocus
prop inRichText
.It does this by adding the prop back in.
How has this been tested?
It was verified that setting the
keepPlaceholderOnFocus
prop to true makes the placeholder still show when selected/focused without content.Types of Changes
Bug Fix: Fix backwards compatibility issues arising from accidentally removing the
keepPlaceholderOnFocus
prop fromRichText
.Checklist: