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

Quote block placeholder is not visible #1970

Closed
ceyhun opened this issue Feb 28, 2020 · 2 comments · Fixed by WordPress/gutenberg#22561 or #2307
Closed

Quote block placeholder is not visible #1970

ceyhun opened this issue Feb 28, 2020 · 2 comments · Fixed by WordPress/gutenberg#22561 or #2307
Assignees
Labels
[OS] Android [Type] Bug Something isn't working

Comments

@ceyhun
Copy link
Contributor

ceyhun commented Feb 28, 2020

Describe the bug

Quote block's Write Quote... placeholder is not visible on Android

To Reproduce

  1. Add Quote block
  2. The Write Quote... placeholder on top of Write Citation... placeholder doesn't appear on Android

Expected behavior

There should be a Write Quote... placeholder on top of Write Citation... placeholder

Screenshots

Android iOS
android-quote ios-quote

Smartphone (please complete the following information):

  • Device: Nexus 5X API 29 x86 emulator
  • OS: Android 10.0
  • Version: 1.24.0

Additional context

Realised this while implementing Pullquote block: #1920
WordPress/gutenberg#20265

Quote block uses RichText to implement the text inputs and issue seems to be with that component. For the Quote block the only difference between the quote and citation input fields is that the quote input gets the multiline prop passed in: https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/quote/edit.js#L45

When multiline prop is removed it works as expected.

@mchowning mchowning mentioned this issue Mar 11, 2020
2 tasks
@ceyhun ceyhun mentioned this issue Apr 1, 2020
@mchowning mchowning added [OS] Android [Type] Bug Something isn't working labels May 5, 2020
@mchowning mchowning changed the title [Android] Quote block placeholder is not visible Quote block placeholder is not visible May 5, 2020
@cameronvoell cameronvoell self-assigned this May 21, 2020
@cameronvoell
Copy link
Contributor

cameronvoell commented May 22, 2020

Going to save a few notes on here (perhaps for myself).

We are seeing the missing placeholder because multiline prop/functionality causes empty paragraph tags (<p></p>) to be sent to our RichText, and it needs to be completely empty for the placeholder to be shown. See note in comment here:
https://github.com/WordPress/gutenberg/blob/316c2f9ef46ed821190e2229ba0b71d01c2bd54a/packages/rich-text/src/component/index.native.js#L681-L684

If we simply catch when we have an empty paragraph tag, and set the text to an empty string (""), we start seeing some immediate problems. Basically some of the functionality around selecting and manipulating multiline quotations is currently reliant on the paragraph tags being there, even when the actual text content is empty. My strategy so far has been trying to fix all the places that need the paragraph tags even for empty content, in order to work. For example this function was breaking if we simply remove paragraph tags for empty strings https://github.com/WordPress/gutenberg/blob/master/packages/rich-text/src/component/index.native.js#L532-L538

Unfortunately, even after a few small victories, I was still seeing some broken behaviors when merging blocks or doing multiline quotes with my strategy of deleting paragraph tags on empty blocks, and fixing the code reliant on them. An alternate strategy is to go to the AztecText on the AztecEditor-Android side and try and catch empty paragraph tags there and still show the placeholder text. As seen in the following link, we're already doing this with some end of line characters, so this could be a viable strategy, but will just be slower to test, and potentially more dangerous with affecting other users of AztecAndroid: https://github.com/wordpress-mobile/AztecEditor-Android/blob/1e09b7daa88498c2c8d62b09cee0c8af8bb86616/aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt#L1795-L1801

@cameronvoell
Copy link
Contributor

cameronvoell commented May 23, 2020

I was still seeing some broken behaviors when merging blocks or doing multiline quotes with my strategy of deleting paragraph tags on empty blocks, and fixing the code reliant on them.

I was able to get this working with a relatively safe looking change. The fix itself appears a bit unintuitive, and could probably use a larger refactor, but the more minimal change here in the following PR's seemed like the least intrusive way to fix this in the near term:
Gutenberg PR: WordPress/gutenberg#22561
Gutenberg-Mobile PR: #2307

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[OS] Android [Type] Bug Something isn't working
Projects
None yet
3 participants