Jetpack: Revue: required label is not aligned properly

Created on 30 Apr 2020  路  4Comments  路  Source: Automattic/jetpack

When adding a new Revue block to a post, you'll notice that the Required labels aren't aligned properly in the editor:

image

On the frontend, everything looks good:
image

This can be reproduced with different themes, including Twenty Twenty and Twenty Seventeen.

[Block] Revue [Pri] Normal [Type] Bug

Most helpful comment

This issue should be automatically sorted with https://github.com/Automattic/jetpack/pull/15362.

To give more context: the Revue block reuses the JetpackFieldLabel component from the Contact Form block.
Currently, JetpackFieldLabel uses the Gutenberg's PlainText component, which renders a <textarea>.
With the Contact Form v2 update, JetpackFieldLabel will use the RichText component instead.
RichText renders a contenteditable element (in this case an actual <label>) which, exactly as proposed by @truongwp, will fix the "required" position. 馃檪

Screenshot 2020-05-05 at 18 03 15

All 4 comments

Hi @jeherve,

I would like to contribute to this issue. I hope it does not conflict with others' work.

My solution is using <span contenteditable> instead of <textarea> for the label edit. The label edit will be like this:

<span contenteditable>Email address</span> <span>(required)</span>

With this markup, the (require) text is always at the end of the label, like on the frontend.

How do you think?

This issue should be automatically sorted with https://github.com/Automattic/jetpack/pull/15362.

To give more context: the Revue block reuses the JetpackFieldLabel component from the Contact Form block.
Currently, JetpackFieldLabel uses the Gutenberg's PlainText component, which renders a <textarea>.
With the Contact Form v2 update, JetpackFieldLabel will use the RichText component instead.
RichText renders a contenteditable element (in this case an actual <label>) which, exactly as proposed by @truongwp, will fix the "required" position. 馃檪

Screenshot 2020-05-05 at 18 03 15

That's good. I will try the above PR. Thanks.

This should be fixed now that #15362 has merged. Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings