Skip to content

fixed search block front-end placeholder issue.#45838

Closed
viralsampat-multidots wants to merge 4 commits intoWordPress:trunkfrom
viralsampat-multidots:fixed/45837_search_block_placeholder
Closed

fixed search block front-end placeholder issue.#45838
viralsampat-multidots wants to merge 4 commits intoWordPress:trunkfrom
viralsampat-multidots:fixed/45837_search_block_placeholder

Conversation

@viralsampat-multidots
Copy link
Copy Markdown
Contributor

What?

The PR is added placeholder text into the search block for front-end view.

Why?

I have checked search block and found that the placeholder text was displaying on editor side, But somehow it not displaying on front-end side. So, I have added placeholder text into the attributes array added it for front-end.

How?

First, I have checked its code and found that attribute array key "Placeholder" is blank. So, I have added if condition and then added value for array key "Placeholder".

Testing Instructions

  1. Open a Post or Page.
  2. Insert a Search Block.
  3. Publish a Post or Page.

Screenshots or scree

after_added_custom_placeholder

Closed: #45837

@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Nov 17, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 17, 2022
@github-actions
Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @viralsampat-multidots! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

Copy link
Copy Markdown
Contributor

@alexstine alexstine left a comment

Choose a reason for hiding this comment

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

@viralsampat-multidots Thanks for the PR! Just one small suggestion.


// Check array attributes place holder value isset or not
if( empty( $attributes['placeholder'] ) ) {
$attributes['placeholder'] = 'Optional placeholder…';
Copy link
Copy Markdown
Contributor

@alexstine alexstine Nov 18, 2022

Choose a reason for hiding this comment

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

Suggested change
$attributes['placeholder'] = 'Optional placeholder…';
$attributes['placeholder'] = __( 'Search here…' );

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hello @alexstine

Hope you are doing well.

As I checked still this issue is open. So, Can I have to make this change and add another PR for review?

Please review it and let me know your feedback. Then I will work accordingly.

Thanks,

@skorasaurus skorasaurus added [Block] Search Affects the Search Block - used to display a search field [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Nov 22, 2022
@skorasaurus
Copy link
Copy Markdown
Member

Hi,

Thank you for your effort. At first impression, this would appear to be a logical and easy fix although I am skeptical whether WP should implement a placeholder (on the front end or the backend) in a search box.

There are few posts from respectable accessibility and usability outlets that discourage their use.
https://www.deque.com/blog/accessible-forms-the-problem-with-placeholders/ and https://digital.gov/2014/11/24/placeholder-text-think-outside-the-box/

@alexstine
Copy link
Copy Markdown
Contributor

I'd rather not have the placeholder at all. However, if it exists on the back-end, makes little sense to not include it on the front-end or remove it from the back-end.

@viralsampat-multidots
Copy link
Copy Markdown
Contributor Author

I'd rather not have the placeholder at all. However, if it exists on the back-end, makes little sense to not include it on the front-end or remove it from the back-end.

Hello @alexstine

I know the placeholder exists on the back end, makes little sense to not include it on the front end. But for accessibility and user interaction purposes, we can add it on the front end as well.

I have made the above-mentioned change and I have removed placeholder text from the back end as well.

Please let me know still need to make any changes or share your feedback for the same.

Thanks,

Copy link
Copy Markdown
Contributor

@alexstine alexstine left a comment

Choose a reason for hiding this comment

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

LGTM.

@alexstine
Copy link
Copy Markdown
Contributor

@viralsampat-multidots While this PR looks fine I think, probably need to remove this from the back-end.

@viralsampat-multidots
Copy link
Copy Markdown
Contributor Author

Hello Team,

Here, I am seeing one error message like "This branch has conflicts that must be resolved", So please let me know if I need to do anything to move further.

Please share your valuable feedback.

Thanks,

@aristath
Copy link
Copy Markdown
Member

Here, I am seeing one error message like "This branch has conflicts that must be resolved", So please let me know if I need to do anything to move further.

Hey there!
You will need to rebase the PR (or merge trunk in your branch, whichever is easier for you) and resolve the conflicts.

@alexstine
Copy link
Copy Markdown
Contributor

@aristath How does this one move forward? I am actually unsure anything can happen here if this placeholder field on the back-end is currently being used. It is not displayed on the front-end so in theory it could be eliminated but this feels more for project leadership to decide. I am not 100% against placeholder text but I would prefer not introducing a feature that users will misuse.

It does appear that this is somehow being used though.

https://github.com/WordPress/wporg-documentation-2022/blob/trunk/source/wp-content/themes/wporg-documentation-2022/parts/search.html

If you check the front-end of the site, placeholder text is there.

https://wordpress.org/documentation/article/wordpress-block-editor/

I think we might be too late to fully eliminate placeholder text.

Thanks.

@viralsampat-multidots
Copy link
Copy Markdown
Contributor Author

viralsampat-multidots commented Apr 4, 2023

@alexstine I think that we have two options for now.

  1. We can remove placeholder text completely from both places ( Front-end & Backend )
  2. We can add placeholder text in both places( Front-end & Backend ).

What do you guys think? Please share your feedback for the same.

Thanks,

@skorasaurus
Copy link
Copy Markdown
Member

Sorry for the delay @viralsampat-multidots; Thank you again for your effort.

Personally, I would not have the use of placeholders although the degree of negative impact when they're used varies (based on color contrast, length of the placeholder text and of the text both etc).

(A couple more articles that discourage the use of placeholders)

https://design-system.service.gov.uk/components/text-input/

https://www.smashingmagazine.com/2018/06/placeholder-attribute/

How to proceed:
the issue itself was closed by @carolinan a couple months ago so I would defer to her (as someone who's far more involved with the team).

@viralsampat-multidots viralsampat-multidots closed this by deleting the head repository May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Search Affects the Search Block - used to display a search field First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search placeholder not displaying on front-end

4 participants