Skip to content

Conversation

kurapativyshnavi
Copy link

@kurapativyshnavi kurapativyshnavi commented Sep 13, 2025

Related issue: #2

This PR improves the accessibility of the search functionality by:

Adding a dedicated search.html page to display search results with proper headings and regions.

Updating the search form to include a submit action (action="/search/") so users can navigate to a full search results page.

Ensuring screen reader feedback is available for both the dropdown and the results page (aria-live="polite").

Why
Previously, search only displayed a dropdown with results and provided limited screen reader feedback. With these changes, users (especially screen reader users) can now:

Submit a search query and access results on a separate page.

Navigate results more easily with semantic HTML and ARIA support.

@rianrietveld
Copy link
Member

Thank you @kurapativyshnavi
I'll look into it on Monday

@kurapativyshnavi
Copy link
Author

Hi @rianrietveld and @joedolson,

I've been looking into the failed "Deploy PR Preview" check on this pull request. The logs show a permissions error: remote: Permission to wpaccessibility/wp-a11y-docs.git denied to github-actions[bot].

It seems like the automated deployment process is being blocked because the GitHub Actions bot doesn't have permission to write to the gh-pages branch. Could an admin please check the repository settings to resolve this?

I've also addressed the issue itself in the code, but the check will continue to fail until the permissions are updated.

Thanks for your help!

@rianrietveld
Copy link
Member

hi @kurapativyshnavi, thanks for reporting. I created an issue for the failing Github actions.
See #100.

Copy link
Member

@joedolson joedolson left a comment

Choose a reason for hiding this comment

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

This is a good start; there are some further changes that I think would make this better. Thank you!

autocomplete="off"
>

<button type="submit" class="search-submit">Search</button>
Copy link
Member

Choose a reason for hiding this comment

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

As part of this change, let's also update the CSS to make the submit button visible.

const query = urlParams.get("q");

if (query) {
const resultsContainer = document.getElementById("search-results-page");
Copy link
Member

Choose a reason for hiding this comment

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

We should use the query to re-populate the search input. It will need to be sanitized before being inserted into the text field.

} else {
resultsContainer.innerHTML = `<p>No results found for "<strong>${query}</strong>".</p>`;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Should also generate an error if the searchIndex or searchDocs properties are not present.

// ---------------------------
// Full Search Results Page
// ---------------------------
document.addEventListener("DOMContentLoaded", function () {
Copy link
Member

Choose a reason for hiding this comment

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

The jtd.onReady method is a wrapper for DOMContentLoaded in this script package, so let's just use that.

const resultsContainer = document.getElementById("search-results-page");
if (resultsContainer) {
// Ensure index and docs exist
if (window.jtdSearchIndex && window.jtdSearchDocs) {
Copy link
Member

Choose a reason for hiding this comment

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

If initSearch hasn't completed, then these will be empty when the DOM loads. I think we probably need to defer this to ensure that initSearch is finished? As the content gets larger, that function is likely to take longer to execute.

@joedolson
Copy link
Member

@kurapativyshnavi Are you going to have a chance to finish this up? It's a great start, and would love to see you get it in!

@kurapativyshnavi
Copy link
Author

yes,i am willing to do @joedolson.
Thank you

@joedolson
Copy link
Member

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PRs to review
Development

Successfully merging this pull request may close these issues.

Improve the accessibility of the search option
3 participants