Skip to content
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

themes: use noscript for search js notification #9617

Conversation

jdknight
Copy link
Contributor

@jdknight jdknight commented Sep 7, 2021

Feature or Bugfix

  • Feature

Purpose

The "search.html" template will generate a warning admonition about requiring JavaScript for search and automatically hiding the element when supported. While functional, if a client renders the page slowly, the warning notification may be visible to the user for a moment.

Instead of relying on JavaScript to suppress this warning, use a noscript tag to hide the warning for clients who do not support JavaScript. This also has the benefit of one less JavaScript call required by a client.

Detail

The following example shows the loading of a documentation, where the search warning is temporarily visible:

(during page load)
image

(after page load)
image

The switch to noscript tags prevents this.

The "search.html" template will generate a warning admonition about
requiring JavaScript for search and automatically hiding the element
when supported. While functional, if a client renders the page slowly,
the warning notification may be visible to the user for a moment.

Instead of relying on JavaScript to suppress this warning, use a
`noscript` tag to hide the warning for clients who do not support
JavaScript. This also has the benefit of one less JavaScript call
required by a client.

Signed-off-by: James Knight <james.d.knight@live.com>
@tk0miya tk0miya added this to the 4.2.0 milestone Sep 11, 2021
tk0miya added a commit that referenced this pull request Sep 11, 2021
@tk0miya
Copy link
Member

tk0miya commented Sep 11, 2021

Merged this into the 4.x branch manually. Thank you for your contribution!

@tk0miya tk0miya closed this Sep 11, 2021
@jdknight jdknight deleted the use-noscript-for-search-js-detection branch September 11, 2021 17:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants