Skip to content

Conversation

@Paul-Hebert
Copy link
Contributor

@Paul-Hebert Paul-Hebert commented Jul 22, 2021

Overview

This PR wraps the help text in and alert, and adjust the spacing between the reply form and the comment above.

The goal is to more clearly distinguish the reply form from the comment, and make it clear that the help text is connected to the reply form, not the comment above.|

Screenshots

Screen Shot 2021-07-22 at 12 48 33 PM

Testing

  1. Review the preview deploy

Fixes #1427

/CC @tylersticka

This PR wraps the help text in and alert, and adjust the spacing between the reply form and the comment above.

The goal is to more clearly distinguish the reply form from the comment, and make it clear that the help text is connected to the reply form, not the comment above.|

Fixes #1427
@changeset-bot
Copy link

changeset-bot bot commented Jul 22, 2021

🦋 Changeset detected

Latest commit: 359e3bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudfour/patterns Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 26 to 34
{% if wrap_help_text_in_alert %}
{% embed '@cloudfour/components/alert/alert.twig' %}
{% block content %}
{{help_text}}
{% endblock %}
{% endembed %}
{% else %}
{{help_text}}
{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be simpler if we used blocks instead of a property?

Suggested change
{% if wrap_help_text_in_alert %}
{% embed '@cloudfour/components/alert/alert.twig' %}
{% block content %}
{{help_text}}
{% endblock %}
{% endembed %}
{% else %}
{{help_text}}
{% endif %}
{% block help_text %}
{% if help_text is not empty %}
{% embed '@cloudfour/components/alert/alert.twig' %}
{% block content %}
{{help_text}}
{% endblock %}
{% endembed %}
{% endif %}
{% endblock %}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. This component is used in two different places:

  • Leaving a comment on a post
  • Responding to a comment on a post

I think the following things are the same in both use cases:

  • The help text content
  • The aria-describedby link between the help text and the textarea

I think the following is different:

  • Whether the help text should be wrapped in an alert.

If I'm understanding your suggestion correctly, we would need to pass in the help text content, and maintain the aria-describedby link manually when we didn't want the help text in an alert. That seems like more of a maintenance burden than adding a new property, but I may be misunderstanding the suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we not want the help text in an alert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, perhaps I had misunderstood. My impression was we didn't want to use the alert in the main "Leave a comment" form.

image

If that's not the case then you're right that this new prop is over-complicating things. I can switch to using an alert everywhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's keep it consistent!

Comment on lines 54 to 57
/// The top margin matches the grid gap spacing applied to the comment form.
/// Otherwise, the form's help text appears visually closer to the comment
/// you're responding to than to the form.
margin-top: ms.step(2, 1rem);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider using what's used for the replies themselves to inherit any rhythm object spacing?

margin-top: var(--rhythm, #{size.$rhythm-default});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was doing previously, but the rhythm spacing between replies is smaller than the spacing within the comment form.

This led to the help text being closer to the comment above it than to the rest of the form. I worried that made it less clear what the help text was connected to.

Though maybe if the rhythm spacing used on the WP site is larger that won't be an issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, can we use whatever token the form is using instead of a new number? (And if it's not using a token, maybe it should be?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can switch the form to using a token and use it here as well.

heading_text: "Reply to #{comment.author.name}",
heading_class: 'u-hidden-visually',
main_label: 'Reply',
wrap_help_text_in_alert: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See earlier comment about using a block instead of a boolean property.

@Paul-Hebert Paul-Hebert marked this pull request as ready for review July 22, 2021 20:07
@Paul-Hebert
Copy link
Contributor Author

Thanks @tylersticka ! Based on your feedback I made a couple changes:

  • The Comment Form always wraps the help text in an alert so we no longer need a new prop bd3428c
  • The Comment uses tokens for its gaps. The vertical gap token is also used for the space between the reply form and the comment above it 2249cf9

Let me know if you'd like any further changes. Thanks!

@Paul-Hebert Paul-Hebert requested a review from tylersticka July 22, 2021 21:25
tylersticka
tylersticka previously approved these changes Jul 22, 2021
@use '../../compiled/tokens/scss/size';
@use '../../mixins/headings';
@use '../../mixins/theme';
@use "../../mixins/ms";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope 👍 Removed

@Paul-Hebert
Copy link
Contributor Author

@tylersticka removing the ms mixin dismissed your review. Mind re-approving?

@Paul-Hebert Paul-Hebert merged commit f77fba9 into v-next Jul 22, 2021
@Paul-Hebert Paul-Hebert deleted the feat/reply-help-text-alert branch July 22, 2021 22:42
@github-actions github-actions bot mentioned this pull request Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refine design of comment reply form

3 participants