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

Chrome/Safari: Unable to type in empty RichText element that's flexed #56272

Closed
dougwollison opened this issue Nov 17, 2023 · 6 comments
Closed
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Bug An existing feature does not function as intended

Comments

@dougwollison
Copy link
Contributor

Description

In several instances we use flex layout on rich text elements for better handling of pseudo elements, like icons on buttons. However, in 6.4, I can no longer type in an empty button for instance, not unless the flex is turned off (the cursor is visible but typing doesn't update anything).

This appears to be caused by #53341 which removed the contenteditable="false" attribute from the placeholder span.

My bandaid fix has been to set the placeholder span to display: contents. This enables typing into the area, but the cursor does not consistently render in Safari.

Step-by-step reproduction instructions

  1. Setup styling so .wp-block-button__link is display: flex; (inline-flex also works)
  2. Add a new button in the editor
  3. Try focusing the button to type in content

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.4, Gutenberg 16.2-16.7, custom theme
  • Chrome 119, Safari 17.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@dougwollison dougwollison added the [Type] Bug An existing feature does not function as intended label Nov 17, 2023
@dougwollison dougwollison changed the title Chrome: Unable to type in empty RichText element that's flexed Chrome/Safari: Unable to type in empty RichText element that's flexed Nov 17, 2023
@Mamaduka Mamaduka added the [Package] Rich text /packages/rich-text label Nov 18, 2023
@Mamaduka
Copy link
Member

cc @ellatrix

@Mamaduka Mamaduka added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable and removed [Package] Rich text /packages/rich-text labels Nov 18, 2023
@jakeparis
Copy link
Contributor

Confirming this issue. Displaying a RichText element, with a placeholder attribute, inside a div which has display:flex causes an issue where you can't type into the RichText element.

Confirming the fix: Setting .my-custom-flex-div .rich-text [data-rich-text-placeholder] { display: contents; } fixes the issue.

@sergiu-radu
Copy link

Any updates on this issue?

I don't think the display: contents is the best solution as it makes the typing cursor disappear.

@ellatrix
Copy link
Member

Is this the same issue as #59192, which I just fixed in #59473?

@sergiu-radu
Copy link

Is this the same issue as #59192, which I just fixed in #59473?

Hi @ellatrix,
Yep, seems this is the same issue :)

Thank you very much!

@ellatrix
Copy link
Member

ellatrix commented Mar 1, 2024

Fixed by #59473 :)

@ellatrix ellatrix closed this as completed Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants