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
Prevent empty heading in contact form #1515
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b6f3609
Only render contact heading if not empty
kmeleta d7e03f6
Add fallback form heading
kmeleta 1a6f10e
Move title string
kmeleta 696ad7c
Update 21 translation files
translation-platform[bot] 330db87
Update 3 translation files
translation-platform[bot] 7616c28
Update 6 translation files
translation-platform[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This
contact-form.liquid
file is used for the contact form section and the contact page template.Adding this condition will remove the heading for sections and for page templates.
Something to consider is that there is no guarantee that a merchant will use the
Contact us
Title for the contact us page. The contact us template can also be assigned to multiple pages, other than the contact us page.We could consider using a hidden
h2
for sections when a merchant doesn't include a heading for the section.^ This may be more verbose for a Contact us page assigned to the the contact us template. That said, this section can be added to other templates, unrelated to the contact us page, and it could be useful to add the hidden
h2
to make the purpose of the form clearer.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.
Agreed. As is the same solution suggested in #1457.
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.
I see, yeah that makes sense. Would "Contact form" be acceptable language? I think this already exists as a translated string, where as "Contact us" does not, far as I'm aware.
edit: I'm wrong. I'd need to add one anyway.
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.
Scott, just to clarify for Ken: you are aligned with always including the hidden
h2
on templates and sections if no heading is included?So instead of:
We would use something like:
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.
The verbosity concern is fair. Is there a way to detect section vs template? If not no worries. I feel the need for a visually hidden
h2
when a section title is empty outweighs the duplicateh1
&h2
text on the contact page. It may be a little confusing at first but this also resolves the empty heading error detected.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.
Short answer: Yes.
We know that the
contact-us.liquid
is a section. It will always be used as a section.We can check if a template is a
page
. For example,request.page_type
can tell us that the template is apage
. We can also check the template name withtemplate.name
-->page.contact
. However, because the contact us page template can be assigned to multiple pages, I would recommend the duplicate heading, instead of conditionally removing it for this page template (Contact us).If we use
Contact form
as the heading (as Ken suggested), there is less likely to be exactly the same heading as the page title, and would be useful in other template contexts. It's not ideal, but like you said "the need for a visually hidden h2 when a section title is empty outweighs the duplicate h1&h2 text on the contact page".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.
Good point. Let's roll with this.